Check-in [5c4a73ae54]

Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:5c4a73ae54fd7739de8aa64391145464c29ed732
Date: 2009-06-15 19:07:26
User: stephan
Comment:fixed a minor hash list sorting issue where the list claimed to be unsorted when it had less than two members.
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to whefs_hash.c

Old (fd78cbdda59246c2) New (44d4823dbd0f122a)
1 #include "whefs.h" // whefs_rc 1 #include "whefs.h" // whefs_rc
2 #include <stdlib.h> // qsort(), bsearch() 2 #include <stdlib.h> // qsort(), bsearch()
3 #include <string.h> // memmove() 3 #include <string.h> // memmove()
4 4
5 #include <assert.h> 5 #include <assert.h>
54 hidden lines
60 const whefs_hashid_list whefs_hashid_list_init = whefs_hashid_list_init_m; 60 const whefs_hashid_list whefs_hashid_list_init = whefs_hashid_list_init_m;
61 61
62 int whefs_hashid_list_sort( whefs_hashid_list * li ) 62 int whefs_hashid_list_sort( whefs_hashid_list * li )
63 { 63 {
64 if( ! li ) return whefs_rc.ArgError; 64 if( ! li ) return whefs_rc.ArgError;
> 65 li->isSorted = true;
65 if( li->count < 2 ) return whefs_rc.OK; 66 if( li->count < 2 ) return whefs_rc.OK;
66 qsort( li->list, li->count, sizeof(whefs_hashid), whefs_hashid_cmp ); 67 qsort( li->list, li->count, sizeof(whefs_hashid), whefs_hashid_cmp );
67 //qsort( li->_head, li->count, sizeof(whefs_hashid), whefs_hashid_cmp ); 68 //qsort( li->_head, li->count, sizeof(whefs_hashid), whefs_hashid_cmp );
68 li->isSorted = true; <
69 #if 1 69 #if 1
70 // shave off zeroed items... 70 // shave off zeroed items...
71 whefs_id_type off = 0; 71 whefs_id_type off = 0;
72 whefs_hashid * h = li->list; 72 whefs_hashid * h = li->list;
73 while( ! h->id && (off<li->count) ) { ++off; ++h; } 73 while( ! h->id && (off<li->count) ) { ++off; ++h; }
233 hidden lines
307 h = &src->list[ndx]; 307 h = &src->list[ndx];
308 } 308 }
309 return whefs_id_type_end; 309 return whefs_id_type_end;
310 } 310 }
311 #endif // unused code 311 #endif // unused code