Changeset 106 for trunk/src/helpers/tree.c
- Timestamp:
- Oct 2, 2001, 8:28:47 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/tree.c
r86 r106 304 304 if (ul1 > ul2) 305 305 return +1; 306 return (0); 307 } 308 309 /* 310 *@@ treeCompareStrings: 311 * standard comparison func if the TREE.ulKey 312 * field really is a string pointer (PCSZ). 313 * 314 * This runs strcmp internally, but can handle 315 * NULL pointers without crashing. 316 * 317 *@@added V0.9.16 (2001-09-29) [umoeller] 318 */ 319 320 int TREEENTRY treeCompareStrings(unsigned long ul1, unsigned long ul2) 321 { 322 #define p1 (const char*)(ul1) 323 #define p2 (const char*)(ul2) 324 325 if (p1 && p2) 326 { 327 int i = strcmp(p1, p2); 328 if (i < 0) return (-1); 329 if (i > 0) return (+1); 330 } 331 else if (p1) 332 // but p2 is NULL: p1 greater than p2 then 333 return (+1); 334 else if (p2) 335 // but p1 is NULL: p1 less than p2 then 336 return (-1); 337 338 // return 0 if strcmp returned 0 above or both strings are NULL 306 339 return (0); 307 340 }
Note:
See TracChangeset
for help on using the changeset viewer.