Go to the source code of this file.
Functions | |
static int | getudef (struct udef_chans *ul, char *name) |
static int | ngetudef (char *name, char *chan) |
static void | setudef (struct udef_struct *us, char *name, int 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 void free_udef | ( | struct udef_struct * | ul | ) | [static] |
Definition at line 109 of file udefchan.c.
References free_udef_chans().
Referenced by channels_close().
00110 { 00111 struct udef_struct *ull; 00112 00113 for (; ul; ul = ull) { 00114 ull = ul->next; 00115 free_udef_chans(ul->values, ul->type); 00116 free(ul->name); 00117 free(ul); 00118 } 00119 }
static void free_udef_chans | ( | struct udef_chans * | ul, | |
int | type | |||
) | [static] |
Definition at line 121 of file udefchan.c.
References UDEF_STR.
Referenced by free_udef(), and tcl_deludef().
00122 { 00123 struct udef_chans *ull; 00124 00125 for (; ul; ul = ull) { 00126 ull = ul->next; 00127 if (type == UDEF_STR && ul->value) { 00128 free((void *)ul->value); 00129 } 00130 free(ul->chan); 00131 free(ul); 00132 } 00133 }
static int getudef | ( | struct udef_chans * | ul, | |
char * | name | |||
) | [static] |
Definition at line 30 of file udefchan.c.
Referenced by cmd_chaninfo(), script_channel_get(), tcl_channel_modify(), and write_channels().
00031 { 00032 int val = 0; 00033 00034 for (; ul; ul = ul->next) 00035 if (!strcasecmp(ul->chan, name)) { 00036 val = ul->value; 00037 break; 00038 } 00039 return val; 00040 }
static void initudef | ( | int | type, | |
char * | name, | |||
int | defined | |||
) | [static] |
Definition at line 77 of file udefchan.c.
References LOG_DEBUG, NULL, and putlog().
00078 { 00079 struct udef_struct *ul, *ul_last = NULL; 00080 00081 if (strlen(name) < 1) 00082 return; 00083 00084 for (ul = udef; ul; ul_last = ul, ul = ul->next) 00085 if (ul->name && !strcasecmp(ul->name, name)) { 00086 if (defined) { 00087 putlog(LOG_DEBUG, "*", "UDEF: %s defined", ul->name); 00088 ul->defined = 1; 00089 } 00090 return; 00091 } 00092 00093 putlog(LOG_DEBUG, "*", "Creating %s (type %d)", name, type); 00094 ul = malloc(sizeof(struct udef_struct)); 00095 ul->name = strdup(name); 00096 if (defined) 00097 ul->defined = 1; 00098 else 00099 ul->defined = 0; 00100 ul->type = type; 00101 ul->values = NULL; 00102 ul->next = NULL; 00103 if (ul_last) 00104 ul_last->next = ul; 00105 else 00106 udef = ul; 00107 }
static int ngetudef | ( | char * | name, | |
char * | chan | |||
) | [static] |
Definition at line 42 of file udefchan.c.
00043 { 00044 struct udef_struct *l; 00045 struct udef_chans *ll; 00046 00047 for (l = udef; l; l = l->next) 00048 if (!strcasecmp(l->name, name)) { 00049 for (ll = l->values; ll; ll = ll->next) 00050 if (!strcasecmp(ll->chan, chan)) 00051 return ll->value; 00052 break; 00053 } 00054 return 0; 00055 }
static void setudef | ( | struct udef_struct * | us, | |
char * | name, | |||
int | value | |||
) | [static] |
Definition at line 57 of file udefchan.c.
References NULL.
Referenced by tcl_channel_modify().
00058 { 00059 struct udef_chans *ul, *ul_last = NULL; 00060 00061 for (ul = us->values; ul; ul_last = ul, ul = ul->next) 00062 if (!strcasecmp(ul->chan, name)) { 00063 ul->value = value; 00064 return; 00065 } 00066 00067 ul = malloc(sizeof(struct udef_chans)); 00068 ul->chan = strdup(name); 00069 ul->value = value; 00070 ul->next = NULL; 00071 if (ul_last) 00072 ul_last->next = ul; 00073 else 00074 us->values = ul; 00075 }