Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

chanvars.h File Reference

#include <asterisk/linkedlists.h>

Include dependency graph for chanvars.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  ast_var_t

Functions

ast_var_tast_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)


Function Documentation

struct ast_var_t* ast_var_assign char *  name,
char *  value
 

Definition at line 20 of file chanvars.c.

References ast_log(), free, LOG_WARNING, and malloc.

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 }

void ast_var_delete struct ast_var_t var  ) 
 

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 }

char* ast_var_name struct ast_var_t var  ) 
 

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 }

char* ast_var_value struct ast_var_t var  ) 
 

Definition at line 76 of file chanvars.c.

References ast_var_t::value.

Referenced by pbx_builtin_getvar_helper().

00077 { 00078 return (var != NULL ? var->value : NULL); 00079 }


Generated on Sat Jun 12 16:41:10 2004 for Asterisk by doxygen 1.3.7