Changeset 505 for trunk/src/sh_files.c
- Timestamp:
- Jun 1, 2016, 8:49:47 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_files.c
r488 r505 1175 1175 typedef struct globstack_entry { 1176 1176 char * name; 1177 char * type_name; 1177 1178 int class; 1178 1179 unsigned long check_flags; … … 1184 1185 static zAVLTree * zglobList = NULL; 1185 1186 1187 zAVLKey zglobstack_key (void const * arg) 1188 { 1189 const sh_globstack_t * sa = (const sh_globstack_t *) arg; 1190 return (zAVLKey) sa->type_name; 1191 } 1192 1193 1186 1194 static int sh_files_pushglob (int class, int type, const char * p, int rdepth, 1187 1195 unsigned long check_flags_in, int flag) … … 1199 1207 globstatus = glob (p, 0, sh_files_globerr, &pglob); 1200 1208 1209 if (sh.flag.checkSum != SH_CHECK_INIT) 1210 { 1211 sh_globstack_t * new_item_ptr; 1212 char * fileName; 1213 char * typeName; 1214 int ret; 1215 1216 SH_MUTEX_TRYLOCK(mutex_zfiles); 1217 fileName = sh_util_strdup (p); 1218 typeName = sh_util_strconcat ((type == SH_LIST_FILE) ? "F" : "D", p, NULL); 1219 1220 new_item_ptr = (sh_globstack_t *) SH_ALLOC (sizeof(sh_globstack_t)); 1221 1222 new_item_ptr->name = fileName; 1223 new_item_ptr->type_name = typeName; 1224 new_item_ptr->class = class; 1225 new_item_ptr->check_flags = check_flags; 1226 new_item_ptr->rdepth = rdepth; 1227 new_item_ptr->type = type; 1228 1229 if (zglobList == NULL) 1230 { 1231 zglobList = zAVLAllocTree (zglobstack_key, zAVL_KEY_STRING); 1232 if (zglobList == NULL) 1233 { 1234 (void) safe_logger (0, 0, NULL); 1235 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 1236 } 1237 } 1238 1239 ret = zAVLInsert (zglobList, new_item_ptr); 1240 1241 if (ret != 0) /* already in list */ 1242 { 1243 SH_FREE(fileName); 1244 SH_FREE(typeName); 1245 SH_FREE(new_item_ptr); 1246 } 1247 SH_MUTEX_TRYLOCK_UNLOCK(mutex_zfiles); 1248 } 1249 1250 1201 1251 if (globstatus == 0 && pglob.gl_pathc > 0) 1202 1252 { 1203 1204 if (sh.flag.checkSum != SH_CHECK_INIT)1205 {1206 sh_globstack_t * new_item_ptr;1207 char * fileName;1208 int ret;1209 1210 SH_MUTEX_TRYLOCK(mutex_zfiles);1211 fileName = sh_util_strdup (p);1212 1213 new_item_ptr = (sh_globstack_t *) SH_ALLOC (sizeof(sh_globstack_t));1214 1215 new_item_ptr->name = fileName;1216 new_item_ptr->class = class;1217 new_item_ptr->check_flags = check_flags;1218 new_item_ptr->rdepth = rdepth;1219 new_item_ptr->type = type;1220 1221 if (zglobList == NULL)1222 {1223 zglobList = zAVLAllocTree (zdirstack_key, zAVL_KEY_STRING);1224 if (zglobList == NULL)1225 {1226 (void) safe_logger (0, 0, NULL);1227 aud__exit(FIL__, __LINE__, EXIT_FAILURE);1228 }1229 }1230 1231 ret = zAVLInsert (zglobList, new_item_ptr);1232 1233 if (ret != 0) /* already in list */1234 {1235 SH_FREE(fileName);1236 SH_FREE(new_item_ptr);1237 }1238 SH_MUTEX_TRYLOCK_UNLOCK(mutex_zfiles);1239 }1240 1241 1253 for (gloop = 0; gloop < (unsigned int) pglob.gl_pathc; ++gloop) 1242 1254 { … … 1351 1363 if (here->name != NULL) 1352 1364 SH_FREE(here->name); 1365 if (here->type_name != NULL) 1366 SH_FREE(here->type_name); 1353 1367 SH_FREE(here); 1354 1368 SL_RET0(_("free_globstack"));
Note:
See TracChangeset
for help on using the changeset viewer.