Changeset 3813 for trunk/pois/NOTES
- Timestamp:
- Apr 29, 2005, 10:53:49 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/pois/NOTES (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pois/NOTES
r3792 r3813 103 103 104 104 The file src/libpois.a has to exist 105 106 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 107 108 psArray* psArrayAlloc(psU32 nalloc) 109 110 fails to initialise the array to NULLs (not specified in the SDRS) 111 112 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 113 114 "bool psListAdd(psList *list, int location, void *data); 115 116 the first function, psListAdd, adds an entry to the list and returns a 117 boolean giving the success or failure of the operation." 118 119 (SDRS). It'd be better to define 120 121 psList *psListAdd(psList *list, int location, void *data); 122 and to make 123 psListAdd(NULL, location, data); 124 equivalent to 125 psListAlloc(data); 126 127 That makes the code to append to a list simpler; instead of 128 129 list = NULL; 130 while(foo) { 131 ... 132 foo = psFooAlloc(); 133 if(list == NULL) { 134 list = psListAlloc(foo); 135 } else { 136 bool ok = psListAdd(list, PS_LIST_TAIL, foo); 137 assert(ok); 138 } 139 psFree(foo); 140 } 141 142 I can simply write: 143 144 list = NULL; 145 while(foo) { 146 ... 147 foo = psFooAlloc(); 148 psListAdd(list, PS_LIST_TAIL, foo); 149 psFree(foo); 150 } 151 152 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 153
Note:
See TracChangeset
for help on using the changeset viewer.
