#include <stdlib.h>#include <string.h>#include <asterisk/chanvars.h>#include <asterisk/logger.h>Go to the source code of this file.
Functions | |
| ast_var_t * | ast_var_assign (char *name, char *value) |
| void | ast_var_delete (struct ast_var_t *var) |
| char * | ast_var_name (struct ast_var_t *var) |
| char * | ast_var_value (struct ast_var_t *var) |
|
||||||||||||
|
Definition at line 20 of file chanvars.c. References ast_log(), free, LOG_WARNING, malloc, ast_var_t::name, and ast_var_t::value. Referenced by ast_channel_alloc(), and pbx_builtin_setvar_helper(). 00021 {
00022 int i;
00023 struct ast_var_t *var;
00024
00025 var = malloc(sizeof(struct ast_var_t));
00026
00027 if (var == NULL)
00028 {
00029 ast_log(LOG_WARNING, "Out of memory\n");
00030 return NULL;
00031 }
00032
00033 i = strlen(value);
00034 var->value = malloc(i + 1);
00035 if (var->value == NULL)
00036 {
00037 ast_log(LOG_WARNING, "Out of memory\n");
00038 free(var);
00039 return NULL;
00040 }
00041
00042 strncpy(var->value, value, i);
00043 var->value[i] = '\0';
00044
00045 i = strlen(name);
00046 var->name = malloc(i + 1);
00047 if (var->name == NULL)
00048 {
00049 ast_log(LOG_WARNING, "Out of memory\n");
00050 free(var->value);
00051 free(var);
00052 return NULL;
00053 }
00054
00055 strncpy(var->name, name, i);
00056 var->name[i] = '\0';
00057
00058 return var;
00059 }
|
|
|
Definition at line 61 of file chanvars.c. References free, ast_var_t::name, and ast_var_t::value. Referenced by ast_channel_free(), pbx_builtin_clear_globals(), and pbx_builtin_setvar_helper(). 00062 {
00063 if (var == NULL) return;
00064
00065 if (var->name != NULL) free(var->name);
00066 if (var->value != NULL) free(var->value);
00067
00068 free(var);
00069 }
|
|
|
Definition at line 71 of file chanvars.c. References ast_var_t::name. Referenced by pbx_builtin_getvar_helper(), and pbx_builtin_setvar_helper(). 00072 {
00073 return (var != NULL ? var->name : NULL);
00074 }
|
|
|
Definition at line 76 of file chanvars.c. Referenced by pbx_builtin_getvar_helper(). 00077 {
00078 return (var != NULL ? var->value : NULL);
00079 }
|
1.4.2