Changeset 228 for test/regfi-threadtest.c
- Timestamp:
- 04/18/11 16:25:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/regfi-threadtest.c
r185 r228 2 2 * A program to stress test regfi under multithreaded use. 3 3 * 4 * Copyright (C) 2005-201 0Timothy D. Morgan4 * Copyright (C) 2005-2011 Timothy D. Morgan 5 5 * Copyright (C) 2002 Richard Sharpe, rsharpe@richardsharpe.com 6 6 * … … 46 46 47 47 48 49 48 void traverseValueList(REGFI_ITERATOR* iter) 50 49 { 51 const REGFI_VK_REC* value; 52 53 value = regfi_iterator_first_value(iter); 54 while(value != NULL) 55 { 50 const REGFI_VK* value; 51 bool ret; 52 53 for(ret=regfi_iterator_first_value(iter); 54 ret; 55 ret=regfi_iterator_next_value(iter)) 56 { 57 value = regfi_iterator_cur_value(iter); 56 58 printMsgs(iter->f); 57 59 regfi_free_record(value); 58 value = regfi_iterator_next_value(iter);59 60 } 60 61 } … … 63 64 void traverseKeyTree(REGFI_ITERATOR* iter) 64 65 { 65 const REGFI_NK _REC* root = NULL;66 const REGFI_NK _REC* cur = NULL;67 const REGFI_NK _REC* sub = NULL;68 const REGFI_SK _REC* sk;66 const REGFI_NK* root = NULL; 67 const REGFI_NK* cur = NULL; 68 const REGFI_NK* sub = NULL; 69 const REGFI_SK* sk; 69 70 bool print_this = true; 70 71 71 72 root = cur = regfi_iterator_cur_key(iter); 72 sub = regfi_iterator_first_subkey(iter); 73 regfi_iterator_first_subkey(iter); 74 sub = regfi_iterator_cur_subkey(iter); 73 75 printMsgs(iter->f); 74 76 … … 86 88 { 87 89 /* We're done with this sub-tree, going up and hitting other branches. */ 90 regfi_free_record(cur); 88 91 if(!regfi_iterator_up(iter)) 89 92 { … … 95 98 /* fprintf(stderr, "%s\n", cur->keyname);*/ 96 99 printMsgs(iter->f); 97 sk = regfi_iterator_cur_sk(iter);98 printMsgs(iter->f);99 100 if(cur == NULL) 100 101 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: unexpected NULL for key.\n"); 101 102 sub = regfi_iterator_next_subkey(iter); 102 sk = regfi_fetch_sk(iter->f, cur); 103 printMsgs(iter->f); 104 regfi_free_record(sk); 105 106 regfi_iterator_next_subkey(iter); 107 sub = regfi_iterator_cur_subkey(iter); 103 108 } 104 109 print_this = false; … … 108 113 * Let's move down and print this first sub-tree out. 109 114 */ 115 regfi_free_record(cur); 110 116 if(!regfi_iterator_down(iter)) 111 117 { … … 118 124 regfi_free_record(sub); 119 125 120 sub = regfi_iterator_first_subkey(iter); 126 regfi_iterator_first_subkey(iter); 127 sub = regfi_iterator_cur_subkey(iter); 121 128 printMsgs(iter->f); 122 129 print_this = true; … … 124 131 printMsgs(iter->f); 125 132 } while(!((cur == root) && (sub == NULL))); 133 regfi_free_record(root); 126 134 127 135 if(print_verbose) … … 138 146 regfi_log_set_mask(REGFI_LOG_INFO|REGFI_LOG_WARN|REGFI_LOG_ERROR); 139 147 140 iter = regfi_iterator_new((REGFI_FILE*)f , REGFI_ENCODING_ASCII);148 iter = regfi_iterator_new((REGFI_FILE*)f); 141 149 if(iter == NULL) 142 150 { … … 198 206 } 199 207 200 f = regfi_alloc(fd );208 f = regfi_alloc(fd, REGFI_ENCODING_ASCII); 201 209 if(f == NULL) 202 210 { … … 214 222 pthread_join(threads[i], NULL); 215 223 224 free(threads); 216 225 regfi_free(f); 217 226 close(fd);
Note: See TracChangeset
for help on using the changeset viewer.