Changeset bb2c60d
- Timestamp:
- Mar 5, 2007, 9:00:24 PM (18 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- d08162a
- Parents:
- 2058d7a
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
perlwrap.pm
r39dc159 rbb2c60d 502 502 # use $shutdown to tell modules that that's what we're doing. 503 503 $BarnOwl::shutdown = 1; 504 BarnOwl::mainloop_hook() ;504 BarnOwl::mainloop_hook() if *BarnOwl::mainloop_hook{CODE}; 505 505 506 506 BarnOwl::shutdown() if *BarnOwl::shutdown{CODE}; -
zephyr.c
rf6050ee rbb2c60d 88 88 owl_free(subs[i].zsub_recipient); 89 89 } 90 90 91 return ret; 91 92 } … … 106 107 char *tmp, *start; 107 108 char buffer[1024], subsfile[1024]; 108 ZSubscription_t subs[3001]; 109 ZSubscription_t *subs; 110 int subSize = 1024; 109 111 int count, ret; 110 112 struct stat statbuff; 111 113 114 subs = owl_malloc(sizeof(ZSubscription_t) * subSize); 112 115 if (filename==NULL) { 113 116 sprintf(subsfile, "%s/%s", owl_global_get_homedir(&g), ".zephyr.subs"); … … 135 138 } 136 139 137 if (count >= 3000) { 138 ret = owl_zephyr_loadsubs_helper(subs, count); 139 if (ret != 0) { 140 fclose(file); 141 return(ret); 140 if (count >= subSize) { 141 ZSubscription_t* newsubs; 142 newsubs = owl_realloc(subs, sizeof(ZSubscription_t) * subSize * 2); 143 if (NULL == newsubs) { 144 /* If realloc fails, load what we've got, clear, and continue */ 145 ret = owl_zephyr_loadsubs_helper(subs, count); 146 if (ret != 0) { 147 fclose(file); 148 return(ret); 149 } 150 count=0; 142 151 } 143 count=0; 152 else { 153 subs = newsubs; 154 subSize *= 2; 155 } 144 156 } 145 157 … … 152 164 subs[count].zsub_recipient=owl_strdup(tmp); 153 165 154 /* if it started with '-' then add it to the global punt list */ 166 /* if it started with '-' then add it to the global punt list, and 167 * remove it from the list of subs. */ 155 168 if (buffer[0]=='-') { 156 169 owl_function_zpunt(subs[count].zsub_class, subs[count].zsub_classinst, subs[count].zsub_recipient, 0); 157 } 158 159 count++; 170 owl_free(subs[count].zsub_class); 171 owl_free(subs[count].zsub_classinst); 172 owl_free(subs[count].zsub_recipient); 173 } 174 else { 175 count++; 176 } 160 177 } 161 178 fclose(file); 162 179 163 180 ret=owl_zephyr_loadsubs_helper(subs, count); 164 181 owl_free(subs); 165 182 return(ret); 166 183 #else
Note: See TracChangeset
for help on using the changeset viewer.