43 |
VALUE_PAIR * |
VALUE_PAIR * |
44 |
avp_alloc() |
avp_alloc() |
45 |
{ |
{ |
46 |
return mem_alloc(sizeof(VALUE_PAIR)); |
return emalloc(sizeof(VALUE_PAIR)); |
47 |
} |
} |
48 |
|
|
49 |
void |
void |
52 |
if (!p) |
if (!p) |
53 |
return; |
return; |
54 |
if (p->type == TYPE_STRING || p->eval) |
if (p->type == TYPE_STRING || p->eval) |
55 |
string_free(p->avp_strvalue); |
efree(p->avp_strvalue); |
56 |
mem_free(p); |
efree(p); |
57 |
} |
} |
58 |
|
|
59 |
/* A/V pair functions */ |
/* A/V pair functions */ |
66 |
|
|
67 |
memcpy(ret, vp, sizeof(VALUE_PAIR)); |
memcpy(ret, vp, sizeof(VALUE_PAIR)); |
68 |
ret->next = NULL; |
ret->next = NULL; |
69 |
if (ret->type == TYPE_STRING || ret->eval) |
if (ret->type == TYPE_STRING || ret->eval) { |
70 |
ret->avp_strvalue = string_dup(vp->avp_strvalue); |
ret->avp_strlength = vp->avp_strlength; |
71 |
|
ret->avp_strvalue = emalloc(ret->avp_strlength+1); |
72 |
|
memcpy(ret->avp_strvalue, vp->avp_strvalue, |
73 |
|
ret->avp_strlength); |
74 |
|
ret->avp_strvalue[ret->avp_strlength] = 0; |
75 |
|
} |
76 |
return ret; |
return ret; |
77 |
} |
} |
78 |
|
|
96 |
pair->prop = dict->prop; |
pair->prop = dict->prop; |
97 |
if (strval) { |
if (strval) { |
98 |
pair->avp_strlength = length; |
pair->avp_strlength = length; |
99 |
pair->avp_strvalue = string_create(strval); |
pair->avp_strvalue = estrdup(strval); |
100 |
} else |
} else |
101 |
pair->avp_lvalue = lval; |
pair->avp_lvalue = lval; |
102 |
|
|
393 |
for ( ; from; from = from->next) { |
for ( ; from; from = from->next) { |
394 |
temp = avp_alloc(); |
temp = avp_alloc(); |
395 |
memcpy(temp, from, sizeof(VALUE_PAIR)); |
memcpy(temp, from, sizeof(VALUE_PAIR)); |
396 |
if (temp->type == TYPE_STRING || temp->eval) |
if (temp->type == TYPE_STRING || temp->eval) { |
397 |
temp->avp_strvalue = string_dup(temp->avp_strvalue); |
char *p = emalloc(temp->avp_strlength+1); |
398 |
|
memcpy(p, temp->avp_strvalue, temp->avp_strlength); |
399 |
|
p[temp->avp_strlength] = 0; |
400 |
|
temp->avp_strvalue = p; |
401 |
|
} |
402 |
temp->next = NULL; |
temp->next = NULL; |
403 |
if (last) |
if (last) |
404 |
last->next = temp; |
last->next = temp; |