resetting manifest requested domain to floor
[platform/upstream/db4.git] / os_brew / globals.c
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 1999-2009 Oracle.  All rights reserved.
5  *
6  * $Id$
7  */
8
9 #include "db_config.h"
10
11 #include "db_int.h"
12
13 /*
14  * brew_bdb_begin --
15  *      Initialize the BREW port of Berkeley DB.
16  */
17 int
18 brew_bdb_begin()
19 {
20         void *p;
21
22         /*
23          * The BREW ARM compiler can't handle statics or globals, so we have
24          * store them off the AEEApplet and initialize them in in-line code.
25          */
26         p = ((BDBApp *)GETAPPINSTANCE())->db_global_values;
27         if (p == NULL) {
28                 if ((p = malloc(sizeof(DB_GLOBALS))) == NULL)
29                         return (ENOMEM);
30                 memset(p, 0, sizeof(DB_GLOBALS));
31
32                 ((BDBApp *)GETAPPINSTANCE())->db_global_values = p;
33
34                 TAILQ_INIT(&DB_GLOBAL(envq));
35                 DB_GLOBAL(db_line) =
36                     "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=";
37         }
38         return (0);
39 }
40
41 /*
42  * brew_bdb_end --
43  *      Close down the BREW port of Berkeley DB.
44  */
45 void
46 brew_bdb_end()
47 {
48         void *p;
49
50         p = ((BDBApp *)GETAPPINSTANCE())->db_global_values;
51
52         free(p);
53 }