Does the following code handle memory allocation correctly for skipping
through every record of a table?
Does MemHandleLock() return a memory pointer? Do I need a recP =
MemPtrNew(sizeof(mydataDB)); somewhere?
Thanks.
mydataDBPtr recP;
UInt16 i, numRecs;
MemHandle recH;
numRecs = DmNumRecords(gDB);
for (i=0; i < numRecs;i++) {
recH = DmQueryRecord(gDB, i);
if (recH) {
recP = (mydataDBPtr)MemHandleLock(recH);
}
// lots of record oriented code here
if (recH) {
MemHandleUnlock(recH);
MemPtrFree(recP);
}
}
Phil Barnett
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/