Go to the source code of this file.
Functions | |
static int | expmem_udef (struct udef_struct *ul) |
static int | expmem_udef_chans (int type, struct udef_chans *ul) |
static intptr_t | getudef (struct udef_chans *ul, char *name) |
static intptr_t | ngetudef (char *name, char *chan) |
static void | setudef (struct udef_struct *us, char *name, intptr_t value) |
static void | initudef (int type, char *name, int defined) |
static void | free_udef (struct udef_struct *ul) |
static void | free_udef_chans (struct udef_chans *ul, int type) |
static int expmem_udef | ( | struct udef_struct * | ul | ) | [static] |
Definition at line 25 of file udefchan.c.
References expmem_udef_chans(), udef_struct::name, udef_struct::next, udef_struct::type, and udef_struct::values.
00026 { 00027 int i = 0; 00028 00029 for (; ul; ul = ul->next) { 00030 i += sizeof(struct udef_struct); 00031 i += strlen(ul->name) + 1; 00032 i += expmem_udef_chans(ul->type, ul->values); 00033 } 00034 return i; 00035 }
static int expmem_udef_chans | ( | int | type, | |
struct udef_chans * | ul | |||
) | [static] |
Definition at line 37 of file udefchan.c.
References udef_chans::chan, udef_chans::next, UDEF_STR, and udef_chans::value.
Referenced by expmem_udef().
00038 { 00039 int i = 0; 00040 00041 for (; ul; ul = ul->next) { 00042 i += sizeof(struct udef_chans); 00043 i += strlen(ul->chan) + 1; 00044 if (type == UDEF_STR && ul->value) 00045 i += strlen((char *) ul->value) + 1; 00046 } 00047 return i; 00048 }
static void free_udef | ( | struct udef_struct * | ul | ) | [static] |
Definition at line 131 of file udefchan.c.
References free_udef_chans(), udef_struct::name, udef_struct::next, nfree, udef_struct::type, and udef_struct::values.
00132 { 00133 struct udef_struct *ull; 00134 00135 for (; ul; ul = ull) { 00136 ull = ul->next; 00137 free_udef_chans(ul->values, ul->type); 00138 nfree(ul->name); 00139 nfree(ul); 00140 } 00141 }
static void free_udef_chans | ( | struct udef_chans * | ul, | |
int | type | |||
) | [static] |
Definition at line 143 of file udefchan.c.
References udef_chans::chan, udef_chans::next, nfree, UDEF_STR, and udef_chans::value.
Referenced by free_udef().
00144 { 00145 struct udef_chans *ull; 00146 00147 for (; ul; ul = ull) { 00148 ull = ul->next; 00149 if (type == UDEF_STR && ul->value) 00150 nfree((void *) ul->value); 00151 nfree(ul->chan); 00152 nfree(ul); 00153 } 00154 }
static intptr_t getudef | ( | struct udef_chans * | ul, | |
char * | name | |||
) | [static] |
Definition at line 50 of file udefchan.c.
References udef_chans::chan, egg_strcasecmp, udef_chans::next, and udef_chans::value.
00051 { 00052 intptr_t val = 0; 00053 00054 for (; ul; ul = ul->next) 00055 if (!egg_strcasecmp(ul->chan, name)) { 00056 val = ul->value; 00057 break; 00058 } 00059 return val; 00060 }
static void initudef | ( | int | type, | |
char * | name, | |||
int | defined | |||
) | [static] |
Definition at line 98 of file udefchan.c.
References debug1, debug2, egg_strcasecmp, udef_struct::next, nmalloc, NULL, and udef.
00099 { 00100 struct udef_struct *ul, *ul_last = NULL; 00101 00102 if (strlen(name) < 1) 00103 return; 00104 00105 for (ul = udef; ul; ul_last = ul, ul = ul->next) 00106 if (ul->name && !egg_strcasecmp(ul->name, name)) { 00107 if (defined) { 00108 debug1("UDEF: %s defined", ul->name); 00109 ul->defined = 1; 00110 } 00111 return; 00112 } 00113 00114 debug2("Creating %s (type %d)", name, type); 00115 ul = nmalloc(sizeof(struct udef_struct)); 00116 ul->name = nmalloc(strlen(name) + 1); 00117 strcpy(ul->name, name); 00118 if (defined) 00119 ul->defined = 1; 00120 else 00121 ul->defined = 0; 00122 ul->type = type; 00123 ul->values = NULL; 00124 ul->next = NULL; 00125 if (ul_last) 00126 ul_last->next = ul; 00127 else 00128 udef = ul; 00129 }
static intptr_t ngetudef | ( | char * | name, | |
char * | chan | |||
) | [static] |
Definition at line 62 of file udefchan.c.
References udef_chans::chan, egg_strcasecmp, udef_struct::name, udef_chans::next, udef_struct::next, udef, udef_chans::value, and udef_struct::values.
00063 { 00064 struct udef_struct *l; 00065 struct udef_chans *ll; 00066 00067 for (l = udef; l; l = l->next) 00068 if (!egg_strcasecmp(l->name, name)) { 00069 for (ll = l->values; ll; ll = ll->next) 00070 if (!egg_strcasecmp(ll->chan, chan)) 00071 return ll->value; 00072 break; 00073 } 00074 return 0; 00075 }
static void setudef | ( | struct udef_struct * | us, | |
char * | name, | |||
intptr_t | value | |||
) | [static] |
Definition at line 77 of file udefchan.c.
References udef_chans::chan, egg_strcasecmp, udef_chans::next, nmalloc, NULL, udef_chans::value, and udef_struct::values.
00078 { 00079 struct udef_chans *ul, *ul_last = NULL; 00080 00081 for (ul = us->values; ul; ul_last = ul, ul = ul->next) 00082 if (!egg_strcasecmp(ul->chan, name)) { 00083 ul->value = value; 00084 return; 00085 } 00086 00087 ul = nmalloc(sizeof(struct udef_chans)); 00088 ul->chan = nmalloc(strlen(name) + 1); 00089 strcpy(ul->chan, name); 00090 ul->value = value; 00091 ul->next = NULL; 00092 if (ul_last) 00093 ul_last->next = ul; 00094 else 00095 us->values = ul; 00096 }