- Timestamp:
- Feb 4, 2011, 3:49:44 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- 0290b2a
- Parents:
- 9de316d1
- git-author:
- David Benjamin <davidben@mit.edu> (01/24/11 23:16:10)
- git-committer:
- David Benjamin <davidben@mit.edu> (02/04/11 15:49:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zephyr.c
rfc7481a rdf3a1f4 1127 1127 #ifdef HAVE_LIBZEPHYR 1128 1128 int ret, num, i, one; 1129 int buffsize;1130 1129 ZSubscription_t sub; 1131 char *out; 1132 one=1; 1130 GString *buf; 1133 1131 1134 1132 ret=ZRetrieveSubscriptions(0, &num); … … 1139 1137 } 1140 1138 1141 buffsize = (num + 1) * 50; 1142 out=owl_malloc(buffsize); 1143 strcpy(out, ""); 1139 buf = g_string_new(""); 1144 1140 for (i=0; i<num; i++) { 1141 one = 1; 1145 1142 if ((ret = ZGetSubscriptions(&sub, &one)) != ZERR_NONE) { 1146 owl_free(out);1147 1143 ZFlushSubscriptions(); 1148 out=owl_strdup("Error while getting subscriptions\n");1149 return (out);1144 g_string_free(buf, true); 1145 return owl_strdup("Error while getting subscriptions\n"); 1150 1146 } else { 1151 int tmpbufflen; 1152 char *tmpbuff; 1153 tmpbuff = owl_sprintf("<%s,%s,%s>\n%s", sub.zsub_class, sub.zsub_classinst, sub.zsub_recipient, out); 1154 tmpbufflen = strlen(tmpbuff) + 1; 1155 if (tmpbufflen > buffsize) { 1156 char *out2; 1157 buffsize = tmpbufflen * 2; 1158 out2 = owl_realloc(out, buffsize); 1159 if (out2 == NULL) { 1160 owl_free(out); 1161 owl_free(tmpbuff); 1162 ZFlushSubscriptions(); 1163 out=owl_strdup("Realloc error while getting subscriptions\n"); 1164 return(out); 1165 } 1166 out = out2; 1167 } 1168 strcpy(out, tmpbuff); 1169 owl_free(tmpbuff); 1147 /* g_string_append_printf would be backwards. */ 1148 char *tmp = owl_sprintf("<%s,%s,%s>\n", 1149 sub.zsub_class, 1150 sub.zsub_classinst, 1151 sub.zsub_recipient); 1152 g_string_prepend(buf, tmp); 1153 owl_free(tmp); 1170 1154 } 1171 1155 } 1172 1156 1173 1157 ZFlushSubscriptions(); 1174 return (out);1158 return g_string_free(buf, false); 1175 1159 #else 1176 1160 return(owl_strdup("Zephyr not available"));
Note: See TracChangeset
for help on using the changeset viewer.