Changeset 425 for trunk/src/sh_ignore.c
- Timestamp:
- Feb 20, 2013, 7:30:02 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_ignore.c
r333 r425 53 53 static struct sh_ignore_list * sh_del_ign = NULL; 54 54 static struct sh_ignore_list * sh_new_ign = NULL; 55 static struct sh_ignore_list * sh_mod_ign = NULL; 55 56 56 57 static struct sh_ignore_list * sh_ignore_add_int(struct sh_ignore_list * list, … … 118 119 } 119 120 121 int sh_ignore_add_mod (const char * addpath) 122 { 123 if ((addpath == NULL) || (addpath[0] != '/')) 124 { 125 return -1; 126 } 127 sh_mod_ign = sh_ignore_add_int (sh_mod_ign, addpath); 128 return 0; 129 } 130 120 131 static int sh_ignore_chk_int (struct sh_ignore_list * list, 121 132 const char * chkpath) … … 159 170 } 160 171 172 int sh_ignore_chk_mod (const char * chkpath) 173 { 174 return (sh_ignore_chk_int(sh_mod_ign, chkpath)); 175 } 176 161 177 int sh_ignore_clean (void) 162 178 { … … 191 207 } 192 208 209 new = sh_mod_ign; 210 211 while (new) 212 { 213 sh_mod_ign = new->next; 214 #ifdef HAVE_REGEX_H 215 regfree (&(new->preg)); 216 #else 217 SH_FREE(new->path); 218 #endif 219 SH_FREE(new); 220 new = sh_mod_ign; 221 } 222 193 223 return 0; 194 224 } … … 205 235 CuAssertTrue(tc, NULL == sh_del_ign); 206 236 CuAssertTrue(tc, NULL == sh_new_ign); 237 CuAssertTrue(tc, NULL == sh_mod_ign); 207 238 208 239 ret = sh_ignore_add_del ("/var/log/foo/.*"); 209 240 CuAssertTrue(tc, 0 == ret); 241 210 242 CuAssertPtrNotNull(tc, sh_del_ign); 243 CuAssertTrue(tc, NULL == sh_new_ign); 244 CuAssertTrue(tc, NULL == sh_mod_ign); 211 245 212 246 ret = sh_ignore_chk_del ("/var/log/foo/test"); 213 247 CuAssertTrue(tc, S_TRUE == ret); 214 CuAssertTrue(tc, NULL == sh_new_ign);215 248 216 249 ret = sh_ignore_chk_del ("/var/log/footest"); … … 223 256 CuAssertTrue(tc, NULL == sh_del_ign); 224 257 CuAssertTrue(tc, NULL == sh_new_ign); 258 CuAssertTrue(tc, NULL == sh_mod_ign); 225 259 226 260 ret = sh_ignore_add_new ("/var/log/foo/.*"); 227 261 CuAssertTrue(tc, 0 == ret); 262 228 263 CuAssertPtrNotNull(tc, sh_new_ign); 229 264 CuAssertTrue(tc, NULL == sh_del_ign); 265 CuAssertTrue(tc, NULL == sh_mod_ign); 230 266 231 267 ret = sh_ignore_chk_new ("/var/log/foo/test"); … … 241 277 CuAssertTrue(tc, NULL == sh_new_ign); 242 278 CuAssertTrue(tc, NULL == sh_del_ign); 279 CuAssertTrue(tc, NULL == sh_mod_ign); 280 281 ret = sh_ignore_add_mod ("/var/log/foo/.*"); 282 CuAssertTrue(tc, 0 == ret); 283 284 CuAssertPtrNotNull(tc, sh_mod_ign); 285 CuAssertTrue(tc, NULL == sh_del_ign); 286 CuAssertTrue(tc, NULL == sh_new_ign); 287 288 ret = sh_ignore_chk_mod ("/var/log/foo/test"); 289 CuAssertTrue(tc, S_TRUE == ret); 290 291 ret = sh_ignore_chk_mod ("/var/log/footest"); 292 CuAssertTrue(tc, S_FALSE == ret); 293 294 ret = sh_ignore_chk_mod ("/my/var/log/footest"); 295 CuAssertTrue(tc, S_FALSE == ret); 296 297 sh_ignore_clean(); 298 CuAssertTrue(tc, NULL == sh_new_ign); 299 CuAssertTrue(tc, NULL == sh_del_ign); 300 CuAssertTrue(tc, NULL == sh_mod_ign); 243 301 244 302 #else
Note:
See TracChangeset
for help on using the changeset viewer.