Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * Neither the name of Nokia Corporation nor the names of its contributors
13 * may be used to endorse or promote products derived from this software
14 * without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __G_LOW_MEM_H__
32 #define __G_LOW_MEM_H__
37 /*-------------------------- Data Structure Decleration ----------------*/
38 typedef struct _cleanUpStack cleanUpStack ;
39 typedef struct _mem_info mem_info ;
55 /*--------------------Function declerations------------------*/
59 #endif /* __cplusplus */
61 IMPORT_C mem_info * _get_thread_specific_data();
62 IMPORT_C int _set_thread_specific_data(mem_info *m);
63 IMPORT_C int _push(cleanUpStack *cs,void *ptr);
64 IMPORT_C void *_pop(cleanUpStack *cs);
65 IMPORT_C void _findAndDestroy(cleanUpStack *cs,void *ptr);
66 IMPORT_C void _destroCleanUpStack(cleanUpStack *cs);
67 IMPORT_C void _clearCleanUpStack(cleanUpStack *cs);
68 IMPORT_C void * _pAlloc(size_t size);
69 IMPORT_C void _dummy1();
70 IMPORT_C void _dummy2();
71 IMPORT_C void _dummy3();
75 #endif /* __cplusplus */
77 /*--------------------MACRO declerations------------------*/
79 #define SET_LOW_MEMORY_TRAP_VOID() \
80 gboolean did_i_set = FALSE;\
82 mem_info *m = _get_thread_specific_data();\
85 m = (mem_info *)_pAlloc(sizeof(mem_info));\
88 m->is_setjmp_called = FALSE;\
89 _clearCleanUpStack(&(m->stack));\
90 if(_set_thread_specific_data(m))\
93 if(!m->is_setjmp_called)\
95 if(setjmp(m->buf) > 0)\
97 m->is_setjmp_called = FALSE;\
98 _destroCleanUpStack(&(m->stack));\
101 m->is_setjmp_called = TRUE;\
106 #define SET_LOW_MEMORY_TRAP(failure_value) \
107 gboolean did_i_set = FALSE;\
109 mem_info *m = _get_thread_specific_data();\
112 m = (mem_info *)_pAlloc(sizeof(mem_info));\
114 return failure_value;\
115 m->is_setjmp_called = FALSE;\
116 _clearCleanUpStack(&(m->stack));\
117 if(_set_thread_specific_data(m))\
118 return failure_value;\
120 if(!m->is_setjmp_called)\
122 if(setjmp(m->buf) > 0)\
124 m->is_setjmp_called = FALSE;\
125 _destroCleanUpStack(&(m->stack));\
126 return failure_value;\
128 m->is_setjmp_called = TRUE;\
134 #define REMOVE_LOW_MEMORY_TRAP() {\
137 mem_info *m = _get_thread_specific_data();\
139 m->is_setjmp_called = FALSE;\
140 _clearCleanUpStack(&(m->stack));\
144 #endif /* __G_LOW_MEM_H__ */