version 1.1.1.1.2.10, 2011/11/22 13:03:26
|
version 1.1.1.1.2.11, 2011/11/28 10:17:12
|
Line 238 mqtt_str2sub(const char **csStr, u_short strnum, u_cha
|
Line 238 mqtt_str2sub(const char **csStr, u_short strnum, u_cha
|
memset(v, 0, (items + 1) * sizeof(mqtt_subscr_t)); |
memset(v, 0, (items + 1) * sizeof(mqtt_subscr_t)); |
|
|
for (i = 0; i < items; i++) { |
for (i = 0; i < items; i++) { |
v[i].sub_sb.val = htons(strlen(csStr[i])); | v[i].sub_topic._size = strlen(csStr[i]); |
v[i].sub_data = strdup(csStr[i]); | v[i].sub_topic._base = strdup(csStr[i]); |
if (qoses && qoses[i] < MQTT_QOS_RESERVED) |
if (qoses && qoses[i] < MQTT_QOS_RESERVED) |
v[i].sub_qos = qoses[i]; | v[i].sub_ret = qoses[i]; |
} |
} |
|
|
return v; |
return v; |
Line 261 mqtt_subFree(mqtt_subscr_t ** __restrict subs)
|
Line 261 mqtt_subFree(mqtt_subscr_t ** __restrict subs)
|
if (!subs) |
if (!subs) |
return; |
return; |
|
|
for (v = *subs; v->sub_data; v++) { | for (v = *subs; v->sub_topic._base; v++) { |
free(v->sub_data); | free(v->sub_topic._base); |
v->sub_data = NULL; | v->sub_topic._base = NULL; |
| v->sub_topic._size = 0; |
} |
} |
|
|
free(*subs); |
free(*subs); |
Line 290 mqtt_subAlloc(u_short num)
|
Line 291 mqtt_subAlloc(u_short num)
|
memset(s, 0, (num + 1) * sizeof(mqtt_subscr_t)); |
memset(s, 0, (num + 1) * sizeof(mqtt_subscr_t)); |
|
|
for (i = 0; i < num; i++) |
for (i = 0; i < num; i++) |
if (!(s[i].sub_data = malloc(0))) { | if (!(s[i].sub_topic._base = malloc(0))) { |
LOGERR; |
LOGERR; |
break; |
break; |
} |
} |