equal
deleted
inserted
replaced
190 { |
190 { |
191 /* must lock the whole time, since zlib doesn't deal with that. :( */ |
191 /* must lock the whole time, since zlib doesn't deal with that. :( */ |
192 PHYSFS_allocator *allocator = __PHYSFS_getAllocator(); |
192 PHYSFS_allocator *allocator = __PHYSFS_getAllocator(); |
193 size_t total = (items * size) + sizeof (PHYSFS_memhandle); |
193 size_t total = (items * size) + sizeof (PHYSFS_memhandle); |
194 PHYSFS_memhandle h = allocator->malloc(total); |
194 PHYSFS_memhandle h = allocator->malloc(total); |
195 char *ptr = (char *) allocator->lock(h); |
195 char *ptr; |
196 PHYSFS_memhandle *ph = (PHYSFS_memhandle *) ptr; |
196 PHYSFS_memhandle *ph; |
|
197 if (h == NULL) |
|
198 return(NULL); |
|
199 |
|
200 ptr = (char *) allocator->lock(h); |
|
201 ph = (PHYSFS_memhandle *) ptr; |
197 *ph = h; /* tuck the memhandle in front of the memory block... */ |
202 *ph = h; /* tuck the memhandle in front of the memory block... */ |
198 return(ptr + sizeof (PHYSFS_memhandle)); |
203 return(ptr + sizeof (PHYSFS_memhandle)); |
199 } /* zlibPhysfsAlloc */ |
204 } /* zlibPhysfsAlloc */ |
200 |
205 |
201 |
206 |