Index: branches/rekursor/CHANGES =================================================================== --- branches/rekursor/CHANGES (revision 10) +++ branches/rekursor/CHANGES (revision 11) @@ -1,8 +1,14 @@ +- Now malloc (ex. MALLOC in Asere patch) is renamed malloc(size) and is an alias + to safe_malloc(size, file, line) with _FILE_ and _LINE_ prerocessor definitions - Added a new 'Rename Partition Feature', now permitting to rename partition like 'System reserved' to a more meaningful name -- Added SystemID option permitting to change the System UUID to a fixed/reproduceable value. +- Added SystemID option permitting to change the System UUID to a fixed value. - Added the PciRoot autodetection feature imported from pcefi10.5 - - Added automatic "system-id" injection from dmi bios, also compatible with SystemID boot option and former SMUUID from smbios,plist - - Added "system-type' automatic injection (1=Desktop) plus override possibility with the new system-type option in bootConfig +- Added automatic "system-id" injection from dmi bios, also compatible + with SystemID boot option and former SMUUID from smbios,plist +- Added "system-type' automatic injection (1=Desktop) plus override possibility + with the new system-type option in bootConfig - Added SMserial and SMproductname new options for smbios.plist -- Merged with asere patch, while keeping my fake_efi.c changes, and adding a new stringForKey() API, also changed the DT__XXXX() set of functions to handle const char * values instead of char*. +- Merged with asere patch, while keeping my fake_efi.c changes, and adding a new + stringForKey() API, also changed the DT__XXXX() set of functions + to handle const char * values instead of char*. Index: branches/rekursor/i386/libsaio/xml.c =================================================================== --- branches/rekursor/i386/libsaio/xml.c (revision 10) +++ branches/rekursor/i386/libsaio/xml.c (revision 11) @@ -509,7 +509,7 @@ if (gTagsFree == 0) { #if USEMALLOC - tag = (TagPtr)MALLOC(kTagsPerBlock * sizeof(Tag)); + tag = (TagPtr)malloc(kTagsPerBlock * sizeof(Tag)); #else tag = (TagPtr)AllocateBootXMemory(kTagsPerBlock * sizeof(Tag)); #endif @@ -590,7 +590,7 @@ if (symbol == 0) { #if USEMALLOC - symbol = (SymbolPtr)MALLOC(sizeof(Symbol) + 1 + strlen(string)); + symbol = (SymbolPtr)malloc(sizeof(Symbol) + 1 + strlen(string)); #else symbol = (SymbolPtr)AllocateBootXMemory(sizeof(Symbol) + 1 + strlen(string)); #endif Index: branches/rekursor/i386/libsaio/bootstruct.c =================================================================== --- branches/rekursor/i386/libsaio/bootstruct.c (revision 10) +++ branches/rekursor/i386/libsaio/bootstruct.c (revision 11) @@ -48,8 +48,8 @@ if ( !init_done ) { - bootArgs = (boot_args *)MALLOC(sizeof(boot_args)); - bootInfo = (PrivateBootInfo_t *)MALLOC(sizeof(PrivateBootInfo_t)); + bootArgs = (boot_args *)malloc(sizeof(boot_args)); + bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t)); if (bootArgs == 0 || bootInfo == 0) stop("Couldn't allocate boot info\n"); Index: branches/rekursor/i386/libsaio/ext2fs.c =================================================================== --- branches/rekursor/i386/libsaio/ext2fs.c (revision 10) +++ branches/rekursor/i386/libsaio/ext2fs.c (revision 11) @@ -20,7 +20,7 @@ void EX2GetDescription(CICell ih, char *str, long strMaxLen) { - char * buf=MALLOC (EX2ProbeSize); + char * buf=malloc (EX2ProbeSize); str[0]=0; if (!buf) return; Index: branches/rekursor/i386/libsaio/device_tree.c =================================================================== --- branches/rekursor/i386/libsaio/device_tree.c (revision 10) +++ branches/rekursor/i386/libsaio/device_tree.c (revision 11) @@ -68,7 +68,7 @@ DPRINTF("DT__AddProperty([Node '%s'], '%s', %d, 0x%x)\n", DT__GetName(node), name, length, value); if (freeProperties == NULL) { - void *buf = MALLOC(kAllocSize); + void *buf = malloc(kAllocSize); int i; DPRINTF("Allocating more free properties\n"); @@ -117,7 +117,7 @@ Node *node; if (freeNodes == NULL) { - void *buf = MALLOC(kAllocSize); + void *buf = malloc(kAllocSize); int i; DPRINTF("Allocating more free nodes\n"); @@ -276,7 +276,7 @@ buf = 0; } else { if (*buffer_p == 0) { - buf = MALLOC(totalSize); + buf = malloc(totalSize); } else { buf = *buffer_p; } @@ -342,7 +342,7 @@ } if (child == 0 && createIfMissing) { DPRINTF("Creating node\n"); - char *str = MALLOC(strlen(nameBuf) + 1); + char *str = malloc(strlen(nameBuf) + 1); // XXX this will leak strcpy(str, nameBuf); Index: branches/rekursor/i386/libsaio/hfs.c =================================================================== --- branches/rekursor/i386/libsaio/hfs.c (revision 10) +++ branches/rekursor/i386/libsaio/hfs.c (revision 11) @@ -152,15 +152,15 @@ } #ifdef __i386__ - if (!gTempStr) gTempStr = (char *)MALLOC(4096); - if (!gLinkTemp) gLinkTemp = (char *)MALLOC(64); - if (!gBTreeHeaderBuffer) gBTreeHeaderBuffer = (char *)MALLOC(512); + if (!gTempStr) gTempStr = (char *)malloc(4096); + if (!gLinkTemp) gLinkTemp = (char *)malloc(64); + if (!gBTreeHeaderBuffer) gBTreeHeaderBuffer = (char *)malloc(512); if (!gHFSMdbVib) { - gHFSMdbVib = (char *)MALLOC(kBlockSize); + gHFSMdbVib = (char *)malloc(kBlockSize); gHFSMDB = (HFSMasterDirectoryBlock *)gHFSMdbVib; } if (!gHFSPlusHeader) { - gHFSPlusHeader = (char *)MALLOC(kBlockSize); + gHFSPlusHeader = (char *)malloc(kBlockSize); gHFSPlus = (HFSPlusVolumeHeader *)gHFSPlusHeader; } if (!gTempStr || !gLinkTemp || !gBTreeHeaderBuffer || @@ -594,7 +594,7 @@ } nodeSize = SWAP_BE16(gBTHeaders[kBTreeCatalog]->nodeSize); - nodeBuf = (char *)MALLOC(nodeSize); + nodeBuf = (char *)malloc(nodeSize); node = (BTNodeDescriptor *)nodeBuf; index = *dirIndex % nodeSize; @@ -726,7 +726,7 @@ curNode = SWAP_BE32(gBTHeaders[btree]->rootNode); nodeSize = SWAP_BE16(gBTHeaders[btree]->nodeSize); - nodeBuf = (char *)MALLOC(nodeSize); + nodeBuf = (char *)malloc(nodeSize); node = (BTNodeDescriptor *)nodeBuf; while (1) { @@ -864,7 +864,7 @@ } if (extentBuffer == 0) { - extentBuffer = MALLOC(sizeofExtent * extentDensity); + extentBuffer = malloc(sizeofExtent * extentDensity); if (extentBuffer == 0) return -1; } Index: branches/rekursor/i386/libsaio/allocate.c =================================================================== --- branches/rekursor/i386/libsaio/allocate.c (revision 10) +++ branches/rekursor/i386/libsaio/allocate.c (revision 11) @@ -39,11 +39,11 @@ char *nameBuf; uint32_t *buffer; - nameBuf = MALLOC(strlen(rangeName) + 1); + nameBuf = malloc(strlen(rangeName) + 1); if (nameBuf == 0) return -1; strcpy(nameBuf, rangeName); - buffer = MALLOC(2 * sizeof(uint32_t)); + buffer = malloc(2 * sizeof(uint32_t)); if (buffer == 0) return -1; buffer[0] = start; Index: branches/rekursor/i386/libsaio/hfs_compare.c =================================================================== --- branches/rekursor/i386/libsaio/hfs_compare.c (revision 10) +++ branches/rekursor/i386/libsaio/hfs_compare.c (revision 11) @@ -35,7 +35,7 @@ static unsigned short * UncompressStructure(struct compressed_block *bp, int count, int size) { - unsigned short *out = MALLOC(size); + unsigned short *out = malloc(size); unsigned short *op = out; unsigned short data; int i, j; Index: branches/rekursor/i386/libsaio/ufs.c =================================================================== --- branches/rekursor/i386/libsaio/ufs.c (revision 10) +++ branches/rekursor/i386/libsaio/ufs.c (revision 11) @@ -127,12 +127,12 @@ gCurrentIH = 0; #ifdef __i386__ - if (!gULBuf) gULBuf = (char *) MALLOC(UFS_LABEL_SIZE); - if (!gFSBuf) gFSBuf = (char *) MALLOC(SBSIZE); - if (!gTempName) gTempName = (char *) MALLOC(MAXNAMLEN + 1); - if (!gTempName2) gTempName2 = (char *) MALLOC(MAXNAMLEN + 1); - if (!gRootInodePtr) gRootInodePtr = (InodePtr) MALLOC(sizeof(Inode)); - if (!gFileInodePtr) gFileInodePtr = (InodePtr) MALLOC(sizeof(Inode)); + if (!gULBuf) gULBuf = (char *) malloc(UFS_LABEL_SIZE); + if (!gFSBuf) gFSBuf = (char *) malloc(SBSIZE); + if (!gTempName) gTempName = (char *) malloc(MAXNAMLEN + 1); + if (!gTempName2) gTempName2 = (char *) malloc(MAXNAMLEN + 1); + if (!gRootInodePtr) gRootInodePtr = (InodePtr) malloc(sizeof(Inode)); + if (!gFileInodePtr) gFileInodePtr = (InodePtr) malloc(sizeof(Inode)); if (!gULBuf || !gFSBuf || !gTempName || !gTempName2 || !gRootInodePtr || !gFileInodePtr) return -1; #endif @@ -168,7 +168,7 @@ gFragSize = gFS->fs_fsize; gFragsPerBlock = gBlockSize / gFragSize; if (gTempBlock != 0) free(gTempBlock); - gTempBlock = MALLOC(gBlockSize); + gTempBlock = malloc(gBlockSize); CacheInit(ih, gBlockSize); gCurrentIH = ih; Index: branches/rekursor/i386/libsaio/pci_root.c =================================================================== --- branches/rekursor/i386/libsaio/pci_root.c (revision 10) +++ branches/rekursor/i386/libsaio/pci_root.c (revision 11) @@ -92,7 +92,7 @@ } fsize = file_size(fd); - if ((new_dsdt = MALLOC(fsize)) == NULL) { + if ((new_dsdt = malloc(fsize)) == NULL) { verbose("[ERROR] alloc DSDT memory failed\n"); close (fd); goto out; Index: branches/rekursor/i386/libsaio/device_inject.c =================================================================== --- branches/rekursor/i386/libsaio/device_inject.c (revision 10) +++ branches/rekursor/i386/libsaio/device_inject.c (revision 11) @@ -72,7 +72,7 @@ if (len > 1) { // the resulting binary will be the half size of the input hex string - binStr = MALLOC(len / 2); + binStr = malloc(len / 2); binStrIdx = 0; hexNibbleIdx = 0; for (hexStrIdx = 0; hexStrIdx < len; hexStrIdx++) @@ -159,7 +159,7 @@ struct DevPropString *devprop_create_string(void) { - string = (struct DevPropString*)MALLOC(sizeof(struct DevPropString)); + string = (struct DevPropString*)malloc(sizeof(struct DevPropString)); if(string == NULL) return NULL; @@ -179,7 +179,7 @@ if (string == NULL || path == NULL) { return NULL; } - device = MALLOC(sizeof(struct DevPropDevice)); + device = malloc(sizeof(struct DevPropDevice)); if (strncmp(path, pciroot_string, strlen(pciroot_string))) { printf("ERROR parsing device path\n"); @@ -260,10 +260,10 @@ string->length += device->length; if(!string->entries) - if((string->entries = (struct DevPropDevice**)MALLOC(sizeof(device)))== NULL) + if((string->entries = (struct DevPropDevice**)malloc(sizeof(device)))== NULL) return 0; - string->entries[string->numentries++] = (struct DevPropDevice*)MALLOC(sizeof(device)); + string->entries[string->numentries++] = (struct DevPropDevice*)malloc(sizeof(device)); string->entries[string->numentries-1] = device; return device; @@ -276,7 +276,7 @@ return 0; uint32_t length = ((strlen(nm) * 2) + len + (2 * sizeof(uint32_t)) + 2); - uint8_t *data = (uint8_t*)MALLOC(length); + uint8_t *data = (uint8_t*)malloc(length); { if(!data) return 0; @@ -306,7 +306,7 @@ uint32_t offset = device->length - (24 + (6 * device->num_pci_devpaths)); - uint8_t *newdata = (uint8_t*)MALLOC((length + offset)); + uint8_t *newdata = (uint8_t*)malloc((length + offset)); if(!newdata) return 0; if(device->data) @@ -320,7 +320,7 @@ device->numentries++; if(!device->data) - device->data = (uint8_t*)MALLOC(sizeof(uint8_t)); + device->data = (uint8_t*)malloc(sizeof(uint8_t)); else free(device->data); @@ -332,7 +332,7 @@ char *devprop_generate_string(struct DevPropString *string) { - char *buffer = (char*)MALLOC(string->length * 2); + char *buffer = (char*)malloc(string->length * 2); char *ptr = buffer; if(!buffer) @@ -427,7 +427,7 @@ void set_eth_builtin(pci_dt_t *eth_dev) { char *devicepath = get_pci_dev_path(eth_dev); - struct DevPropDevice *device = (struct DevPropDevice*)MALLOC(sizeof(struct DevPropDevice)); + struct DevPropDevice *device = (struct DevPropDevice*)malloc(sizeof(struct DevPropDevice)); verbose("LAN Controller [%04x:%04x] :: %s\n", eth_dev->vendor_id, eth_dev->device_id, devicepath); @@ -439,7 +439,7 @@ { verbose("Setting up lan keys\n"); devprop_add_network_template(device, eth_dev->vendor_id); - stringdata = (uint8_t*)MALLOC(sizeof(uint8_t) * string->length); + stringdata = (uint8_t*)malloc(sizeof(uint8_t) * string->length); if(stringdata) { memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); Index: branches/rekursor/i386/libsaio/ntfs.c =================================================================== --- branches/rekursor/i386/libsaio/ntfs.c (revision 10) +++ branches/rekursor/i386/libsaio/ntfs.c (revision 11) @@ -157,7 +157,7 @@ size_t nameSize; char *buf; - buf = (char *)MALLOC(MAX_CLUSTER_SIZE); + buf = (char *)malloc(MAX_CLUSTER_SIZE); if (buf == 0) { goto error; } Index: branches/rekursor/i386/libsaio/nvidia.c =================================================================== --- branches/rekursor/i386/libsaio/nvidia.c (revision 10) +++ branches/rekursor/i386/libsaio/nvidia.c (revision 11) @@ -612,7 +612,7 @@ (REG32(0) >> 20) & 0x1ff, nvda_dev->vendor_id, nvda_dev->device_id, devicepath); - rom = MALLOC(NVIDIA_ROM_SIZE); + rom = malloc(NVIDIA_ROM_SIZE); sprintf(nvFilename, "/Extra/%04x_%04x.rom", (uint16_t)nvda_dev->vendor_id, (uint16_t)nvda_dev->device_id); if (getBoolForKey(kUseNvidiaROM, &doit, &bootInfo->bootConfig) && doit) { verbose("Looking for nvidia video bios file %s\n", nvFilename); @@ -703,7 +703,7 @@ devprop_add_value(device, "vbios", rom, (nvBiosOveride > 0) ? nvBiosOveride : (rom[2] * 512)); } - stringdata = MALLOC(sizeof(uint8_t) * string->length); + stringdata = malloc(sizeof(uint8_t) * string->length); memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); stringlength = string->length; Index: branches/rekursor/i386/libsaio/ati.c =================================================================== --- branches/rekursor/i386/libsaio/ati.c (revision 10) +++ branches/rekursor/i386/libsaio/ati.c (revision 11) @@ -290,7 +290,7 @@ REG32W(0xa8, 0); REG32R(0xac); - BIOSBase = MALLOC(0x10000); + BIOSBase = malloc(0x10000); REG32W(0xa8, 0); BIOSBase[0] = REG32R(0xac); counter = 4; @@ -420,7 +420,7 @@ return 0; } printf("dumping pci config space, 256 bytes\n"); - config_space = MALLOC(256); + config_space = malloc(256); for (i=0; i<=255; i++) { config_space[i] = pci_config_read8( ati_dev->dev.addr, i); } @@ -698,7 +698,7 @@ sprintf(tmp, "/Extra/%04x_%04x.rom", (uint16_t)ati_dev->vendor_id, (uint16_t)ati_dev->device_id); if (getBoolForKey(kUseAtiROM, &doit, &bootInfo->bootConfig) && doit) { verbose("looking for ati video bios file %s\n", tmp); - rom = MALLOC(0x20000); + rom = malloc(0x20000); rom_size = load_ati_bios_file(tmp, rom, 0x20000); if (rom_size > 0x10000) { rom_size = 0x10000; //we dont need rest anyway; @@ -754,7 +754,7 @@ if (toFree) { free(bios); } - stringdata = MALLOC(sizeof(uint8_t) * string->length); + stringdata = malloc(sizeof(uint8_t) * string->length); memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length); stringlength = string->length; Index: branches/rekursor/i386/libsaio/sys.c =================================================================== --- branches/rekursor/i386/libsaio/sys.c (revision 10) +++ branches/rekursor/i386/libsaio/sys.c (revision 11) @@ -326,7 +326,7 @@ const char * entryName; if (gMakeDirSpec == 0) - gMakeDirSpec = (char *)MALLOC(1024); + gMakeDirSpec = (char *)malloc(1024); if (!dirSpec) { long idx, len; @@ -621,7 +621,7 @@ { struct dirstuff * dirp = 0; - dirp = (struct dirstuff *) MALLOC(sizeof(struct dirstuff)); + dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); if (dirp == NULL) goto error; @@ -649,7 +649,7 @@ if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL) goto error; - dirp = (struct dirstuff *) MALLOC(sizeof(struct dirstuff)); + dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); if (dirp == NULL) goto error; Index: branches/rekursor/i386/libsaio/nbp.c =================================================================== --- branches/rekursor/i386/libsaio/nbp.c (revision 10) +++ branches/rekursor/i386/libsaio/nbp.c (revision 11) @@ -120,7 +120,7 @@ if ( !gNetBVR ) { - gNetBVR = MALLOC( sizeof(*gNetBVR) ); + gNetBVR = malloc( sizeof(*gNetBVR) ); if ( gNetBVR ) { bzero(gNetBVR, sizeof(*gNetBVR)); Index: branches/rekursor/i386/libsaio/disk.c =================================================================== --- branches/rekursor/i386/libsaio/disk.c (revision 10) +++ branches/rekursor/i386/libsaio/disk.c (revision 11) @@ -501,7 +501,7 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) MALLOC( sizeof(*bvr) ); + BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); if ( bvr ) { bzero(bvr, sizeof(*bvr)); @@ -570,7 +570,7 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) MALLOC( sizeof(*bvr) ); + BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); if ( bvr ) { bzero(bvr, sizeof(*bvr)); @@ -651,7 +651,7 @@ BVFree bvFreeFunc, int probe, int type, unsigned int bvrFlags ) { - BVRef bvr = (BVRef) MALLOC( sizeof(*bvr) ); + BVRef bvr = (BVRef) malloc( sizeof(*bvr) ); if ( bvr ) { bzero(bvr, sizeof(*bvr)); @@ -751,7 +751,7 @@ do { // Create a new mapping. - map = (struct DiskBVMap *) MALLOC( sizeof(*map) ); + map = (struct DiskBVMap *) malloc( sizeof(*map) ); if ( map ) { map->biosdev = biosdev; @@ -977,7 +977,7 @@ struct Block0 *block0_p; unsigned int blksize; unsigned int factor; - void *buffer = MALLOC(BPS); + void *buffer = malloc(BPS); /* Check for alternate block size */ if (readBytes( biosdev, 0, 0, BPS, buffer ) != 0) { @@ -988,7 +988,7 @@ blksize = OSSwapBigToHostInt16(block0_p->sbBlkSize); if (blksize != BPS) { free(buffer); - buffer = MALLOC(blksize); + buffer = malloc(blksize); } factor = blksize / BPS; } else { @@ -999,7 +999,7 @@ do { // Create a new mapping. - map = (struct DiskBVMap *) MALLOC( sizeof(*map) ); + map = (struct DiskBVMap *) malloc( sizeof(*map) ); if ( map ) { int error; @@ -1075,7 +1075,7 @@ int fatbits; // Allocating buffer for 4 sectors. - const void * probeBuffer = MALLOC(PROBEFS_SIZE); + const void * probeBuffer = malloc(PROBEFS_SIZE); if (probeBuffer == NULL) goto exit; @@ -1129,7 +1129,7 @@ static BVRef diskScanGPTBootVolumes( int biosdev, int * countPtr ) { struct DiskBVMap * map = NULL; - void *buffer = MALLOC(BPS); + void *buffer = malloc(BPS); int error; if ( error = readBytes( biosdev, /*secno*/0, 0, BPS, buffer ) != 0) { verbose("Failed to read boot sector from BIOS device %02xh. Error=%d\n", biosdev, error); @@ -1224,7 +1224,7 @@ UInt32 bufferSize = IORound(gptCount * gptSize, BPS); if(bufferSize == 0) goto scanErr; - buffer = MALLOC(bufferSize); + buffer = malloc(bufferSize); if(readBytes(biosdev, gptBlock, 0, bufferSize, buffer) != 0) goto scanErr; @@ -1232,7 +1232,7 @@ verbose("Read GPT\n"); // Allocate a new map for this BIOS device and insert it into the chain - map = MALLOC(sizeof(*map)); + map = malloc(sizeof(*map)); map->biosdev = biosdev; map->bvr = NULL; map->bvrcnt = 0; @@ -1574,7 +1574,7 @@ /* * Allocate and copy the matched bvr entry into a new one. */ - newBVR = (BVRef) MALLOC(sizeof(*newBVR)); + newBVR = (BVRef) malloc(sizeof(*newBVR)); bcopy(bvr, newBVR, sizeof(*newBVR)); /* @@ -1759,7 +1759,7 @@ { if ( gBootSector == NULL ) { - gBootSector = (struct disk_blk0 *) MALLOC(sizeof(*gBootSector)); + gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); if ( gBootSector == NULL ) return -1; } bootSector = gBootSector; @@ -1796,7 +1796,7 @@ { if ( gBootSector == NULL ) { - gBootSector = (struct disk_blk0 *) MALLOC(sizeof(*gBootSector)); + gBootSector = (struct disk_blk0 *) malloc(sizeof(*gBootSector)); if ( gBootSector == NULL ) return -1; } bootSector = (struct disk_boot1f32_blk *) gBootSector; Index: branches/rekursor/i386/libsaio/cache.c =================================================================== --- branches/rekursor/i386/libsaio/cache.c (revision 10) +++ branches/rekursor/i386/libsaio/cache.c (revision 11) @@ -90,8 +90,8 @@ gCacheIH = ih; #ifdef __i386__ - if (!gCacheBuffer) gCacheBuffer = (char *) MALLOC(kCacheSize); - if (!gCacheEntries) gCacheEntries = (CacheEntry *) MALLOC(kCacheMaxEntries * sizeof(CacheEntry)); + if (!gCacheBuffer) gCacheBuffer = (char *) malloc(kCacheSize); + if (!gCacheEntries) gCacheEntries = (CacheEntry *) malloc(kCacheMaxEntries * sizeof(CacheEntry)); if ( !gCacheBuffer || !gCacheEntries ) { gCacheIH = 0; // invalidate cache Index: branches/rekursor/i386/libsaio/pci.c =================================================================== --- branches/rekursor/i386/libsaio/pci.c (revision 10) +++ branches/rekursor/i386/libsaio/pci.c (revision 11) @@ -81,7 +81,7 @@ if (!id || id == 0xffffffff) { continue; } - new = (pci_dt_t*)MALLOC(sizeof(pci_dt_t)); + new = (pci_dt_t*)malloc(sizeof(pci_dt_t)); bzero(new, sizeof(pci_dt_t)); new->dev.addr = pci_addr; new->vendor_id = id & 0xffff; @@ -111,7 +111,7 @@ void build_pci_dt(void) { - root_pci_dev = MALLOC(sizeof(pci_dt_t)); + root_pci_dev = malloc(sizeof(pci_dt_t)); bzero(root_pci_dev, sizeof(pci_dt_t)); scan_pci_bus(root_pci_dev, 0); #if DEBUG_PCI Index: branches/rekursor/i386/libsaio/stringTable.c =================================================================== --- branches/rekursor/i386/libsaio/stringTable.c (revision 10) +++ branches/rekursor/i386/libsaio/stringTable.c (revision 11) @@ -99,7 +99,7 @@ len = strlen(key); tab = (char *)table; - buf = (char *)MALLOC(len + 3); + buf = (char *)malloc(len + 3); sprintf(buf, "\"%s\"", key); len = strlen(buf); @@ -157,7 +157,7 @@ if (begin == end) return 0; bufsize = end - begin + 1; - newstr = MALLOC(bufsize); + newstr = malloc(bufsize); strlcpy(newstr, begin, bufsize); *list = end; *size = newsize; @@ -234,7 +234,7 @@ int size; if (getValueForConfigTableKey(config, key, &val, &size)) { - newstr = (char *)MALLOC(size+1); + newstr = (char *)malloc(size+1); for (p = newstr; size; size--, p++, val++) { if ((*p = *val) == '\\') { switch (*++val) { @@ -271,7 +271,7 @@ int size; if (getValueForKey(key, &val, &size, config) && size) { - newstr = (char *)MALLOC(size + 1); + newstr = (char *)malloc(size + 1); strlcpy(newstr, val, size + 1); return newstr; } else { @@ -553,7 +553,7 @@ pos = 0; char *configBuffer; - configBuffer = MALLOC(strlen(buffer)+1); + configBuffer = malloc(strlen(buffer)+1); strcpy(configBuffer, buffer); while (1) @@ -711,7 +711,7 @@ char * newString(const char * oldString) { if ( oldString ) - return strcpy(MALLOC(strlen(oldString)+1), oldString); + return strcpy(malloc(strlen(oldString)+1), oldString); else return NULL; } Index: branches/rekursor/i386/libsaio/msdos.c =================================================================== --- branches/rekursor/i386/libsaio/msdos.c (revision 10) +++ branches/rekursor/i386/libsaio/msdos.c (revision 11) @@ -155,7 +155,7 @@ return 0; } - buf=MALLOC (512); + buf=malloc (512); /* * Read the boot sector of the filesystem, and then check the * boot signature. If not a dos boot sector then error out. @@ -629,10 +629,10 @@ st = (struct msdosdirstate *)*dirIndex; if (!st) { - st=MALLOC (sizeof (*st)); + st=malloc (sizeof (*st)); if (dirPath[0]) { - uint8_t *buf=MALLOC(msdosclustersize); + uint8_t *buf=malloc(msdosclustersize); dirp = getdirpfrompath (ih, dirPath, buf); if (!dirp || !(dirp->deAttributes & ATTR_DIRECTORY)) { @@ -664,14 +664,14 @@ { int i; for (i=0;vfatname[i];i++); - *name = MALLOC (256); + *name = malloc (256); utf_encodestr(vfatname, i, (u_int8_t *)*name, 255, OSLittleEndian ); } else { int i, j, k; uint16_t tmp[13]; - *name = MALLOC (26); + *name = malloc (26); for (i=7;i>=0;i--) if (dirp->deName[i]!=' ') break; @@ -724,7 +724,7 @@ return -1; if (filePath[0] == '/') filePath++; - buf = MALLOC(msdosclustersize); + buf = malloc(msdosclustersize); dirp = getdirpfrompath (ih, filePath, buf); if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY)) @@ -773,7 +773,7 @@ return -1; if (filePath[0] == '/') filePath++; - buf = MALLOC(msdosclustersize); + buf = malloc(msdosclustersize); dirp = getdirpfrompath (ih, filePath, buf); if (!dirp || (dirp->deAttributes & ATTR_DIRECTORY)) { @@ -865,7 +865,7 @@ label[0] = '\0'; initRoot (&st); - st.buf = MALLOC(msdosclustersize); + st.buf = malloc(msdosclustersize); while ((dirp = getnextdirent (ih, vfatlabel, &st))) if (dirp->deAttributes & ATTR_VOLUME) { strncpy((char *)label, (char *)dirp->deName, LABEL_LENGTH); @@ -886,7 +886,7 @@ /* else look in the boot blocks */ if (!labelfound || str[0] == '\0') { - char *buf = MALLOC (512); + char *buf = malloc (512); union bootsector *bsp = (union bootsector *)buf; Seek(ih, 0); Read(ih, (long)buf, 512); @@ -906,7 +906,7 @@ long MSDOSGetUUID(CICell ih, char *uuidStr) { - char *buf = MALLOC (512); + char *buf = malloc (512); union bootsector *bsp = (union bootsector *)buf; if (MSDOSInitPartition (ih)<0) Index: branches/rekursor/i386/libsaio/fake_efi.c =================================================================== --- branches/rekursor/i386/libsaio/fake_efi.c (revision 10) +++ branches/rekursor/i386/libsaio/fake_efi.c (revision 11) @@ -57,7 +57,7 @@ static inline char * mallocStringForGuid(EFI_GUID const *pGuid) { - char *string = MALLOC(37); + char *string = malloc(37); efi_guid_unparse_upper(pGuid, string); return string; } @@ -339,7 +339,7 @@ if (!key || !(*key) || !len || !src) return 0; *len = strlen(src); - dst = (EFI_CHAR16*) MALLOC(((*len)+1)*2); + dst = (EFI_CHAR16*) malloc(((*len)+1)*2); for (; i<*len; i++) dst[i] = src[i]; dst[*len] = '\0'; Index: branches/rekursor/i386/boot2/picopng.c =================================================================== --- branches/rekursor/i386/boot2/picopng.c (revision 10) +++ branches/rekursor/i386/boot2/picopng.c (revision 11) @@ -45,7 +45,7 @@ png_alloc_node_t *node; if (png_alloc_find_node(addr)) return; - node = MALLOC(sizeof (png_alloc_node_t)); + node = malloc(sizeof (png_alloc_node_t)); node->addr = addr; node->size = size; node->prev = png_alloc_tail; @@ -73,7 +73,7 @@ void *png_alloc_malloc(size_t size) { - void *addr = MALLOC(size); + void *addr = malloc(size); png_alloc_add_node(addr, size); return addr; } Index: branches/rekursor/i386/boot2/graphics.c =================================================================== --- branches/rekursor/i386/boot2/graphics.c (revision 10) +++ branches/rekursor/i386/boot2/graphics.c (revision 11) @@ -52,7 +52,7 @@ { VBEInfoBlock vbeInfo; int err, small; - char *buff = MALLOC(sizeof(char)*256); + char *buff = malloc(sizeof(char)*256); if(!buff) return 0; bzero( &vbeInfo, sizeof(vbeInfo) ); @@ -151,7 +151,7 @@ if ( err != errSuccess ) return 0; - char *buff=MALLOC(sizeof(char)*3072); + char *buff=malloc(sizeof(char)*3072); if(!buff) return 0; // Loop through the mode list, and find the matching mode. @@ -349,7 +349,7 @@ unsigned char value; } * bp = (struct RLEBlock *) rleData; - out = cp = MALLOC( outBytes ); + out = cp = malloc( outBytes ); if ( out == NULL ) return NULL; while ( rleBlocks-- ) @@ -483,7 +483,7 @@ switch ( VIDEO(depth) ) { case 16 : - img16 = MALLOC(width * height * 2); + img16 = malloc(width * height * 2); if ( !img16 ) break; for (cnt = 0; cnt < (width * height); cnt++) img16[cnt] = lookUpCLUTIndex(imageData[cnt], 16); @@ -491,7 +491,7 @@ break; case 32 : - img32 = MALLOC(width * height * 4); + img32 = malloc(width * height * 4); if ( !img32 ) break; for (cnt = 0; cnt < (width * height); cnt++) img32[cnt] = lookUpCLUTIndex(imageData[cnt], 32); @@ -499,7 +499,7 @@ break; default : - img = MALLOC(width * height); + img = malloc(width * height); bcopy(imageData, img, width * height); break; } @@ -525,7 +525,7 @@ error = -1; goto failed; } - pngData = MALLOC(pngSize); + pngData = malloc(pngSize); if (read(pngFile, (char *) pngData, pngSize) != pngSize) { error = -1; goto failed; @@ -543,7 +543,7 @@ error = -1; goto failed; } - uint8_t *result = MALLOC(info->width*4*info->height); + uint8_t *result = malloc(info->width*4*info->height); *width = info->width; *height = info->height; memcpy(result, info->image->data, info->width*4*info->height); @@ -575,7 +575,7 @@ error = -1; goto failed; } - uint8_t *result = MALLOC(info->width*4*info->height); + uint8_t *result = malloc(info->width*4*info->height); *width = info->width; *height = info->height; memcpy(result, info->image->data, info->width*4*info->height); Index: branches/rekursor/i386/boot2/drivers.c =================================================================== --- branches/rekursor/i386/boot2/drivers.c (revision 10) +++ branches/rekursor/i386/boot2/drivers.c (revision 11) @@ -145,11 +145,11 @@ static long InitDriverSupport( void ) { - gExtensionsSpec = MALLOC( 4096 ); - gDriverSpec = MALLOC( 4096 ); - gFileSpec = MALLOC( 4096 ); - gTempSpec = MALLOC( 4096 ); - gFileName = MALLOC( 4096 ); + gExtensionsSpec = malloc( 4096 ); + gDriverSpec = malloc( 4096 ); + gFileSpec = malloc( 4096 ); + gTempSpec = malloc( 4096 ); + gFileName = malloc( 4096 ); if ( !gExtensionsSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName ) stop("InitDriverSupport error"); @@ -434,7 +434,7 @@ (bundleType == kCFBundleType2) ? "Contents/MacOS/" : ""); executablePathLength = strlen(gFileSpec) + 1; - tmpExecutablePath = MALLOC(executablePathLength); + tmpExecutablePath = malloc(executablePathLength); if (tmpExecutablePath == 0) break; strcpy(tmpExecutablePath, gFileSpec); @@ -442,7 +442,7 @@ sprintf(gFileSpec, "%s/%s", dirSpec, name); bundlePathLength = strlen(gFileSpec) + 1; - tmpBundlePath = MALLOC(bundlePathLength); + tmpBundlePath = malloc(bundlePathLength); if (tmpBundlePath == 0) break; strcpy(tmpBundlePath, gFileSpec); @@ -456,7 +456,7 @@ if (length == -1) break; length = length + 1; - buffer = MALLOC(length); + buffer = malloc(length); if (buffer == 0) break; strlcpy(buffer, (char *)kLoadAddr, length); @@ -471,7 +471,7 @@ module->executablePath = tmpExecutablePath; module->bundlePath = tmpBundlePath; module->bundlePathLength = bundlePathLength; - module->plistAddr = MALLOC(length); + module->plistAddr = malloc(length); if ((module->executablePath == 0) || (module->bundlePath == 0) || (module->plistAddr == 0)) break; @@ -727,7 +727,7 @@ return -2; } - tmpModule = MALLOC(sizeof(Module)); + tmpModule = malloc(sizeof(Module)); if (tmpModule == 0) { XMLFreeTag(moduleDict); @@ -784,7 +784,7 @@ #endif uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size); - binary = buffer = MALLOC(uncompressed_size); + binary = buffer = malloc(uncompressed_size); size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size)); Index: branches/rekursor/i386/boot2/bmdecompress.c =================================================================== --- branches/rekursor/i386/boot2/bmdecompress.c (revision 10) +++ branches/rekursor/i386/boot2/bmdecompress.c (revision 11) @@ -34,10 +34,10 @@ int i, j; uint32_t * input; - uint16_t * sc0 = MALLOC((width+2) * sizeof(uint16_t)); - uint16_t * sc1 = MALLOC((width+2) * sizeof(uint16_t)); - uint16_t * sc2 = MALLOC((width+2) * sizeof(uint16_t)); - uint16_t * sc3 = MALLOC((width+2) * sizeof(uint16_t)); + uint16_t * sc0 = malloc((width+2) * sizeof(uint16_t)); + uint16_t * sc1 = malloc((width+2) * sizeof(uint16_t)); + uint16_t * sc2 = malloc((width+2) * sizeof(uint16_t)); + uint16_t * sc3 = malloc((width+2) * sizeof(uint16_t)); uint32_t sr0, sr1, sr2, sr3; bzero(sc0, (width+2) * sizeof(uint16_t)); @@ -135,10 +135,10 @@ int i, j; uint32_t * input; - uint16_t * sc0 = MALLOC((width+2) * sizeof(uint16_t)); - uint16_t * sc1 = MALLOC((width+2) * sizeof(uint16_t)); - uint16_t * sc2 = MALLOC((width+2) * sizeof(uint16_t)); - uint16_t * sc3 = MALLOC((width+2) * sizeof(uint16_t)); + uint16_t * sc0 = malloc((width+2) * sizeof(uint16_t)); + uint16_t * sc1 = malloc((width+2) * sizeof(uint16_t)); + uint16_t * sc2 = malloc((width+2) * sizeof(uint16_t)); + uint16_t * sc3 = malloc((width+2) * sizeof(uint16_t)); uint32_t sr0, sr1, sr2, sr3; bzero(sc0, (width+2) * sizeof(uint16_t)); @@ -238,7 +238,7 @@ *dw = (int) src[1]; *dh = (int) src[2]; - ret = MALLOC ((*dw * *dh * *bitsPerPixel)/ 8); + ret = malloc ((*dw * *dh * *bitsPerPixel)/ 8); switch(*bitsPerPixel) { Index: branches/rekursor/i386/boot2/gui.c =================================================================== --- branches/rekursor/i386/boot2/gui.c (revision 10) +++ branches/rekursor/i386/boot2/gui.c (revision 11) @@ -158,7 +158,7 @@ for (i=0; i < sizeof(images) / sizeof(images[0]); i++) { if (strcmp(image, images[i].name) == 0) { if (images[i].image == NULL) { - images[i].image = MALLOC(sizeof(pixmap_t)); + images[i].image = malloc(sizeof(pixmap_t)); } width = 0; height = 0; @@ -191,7 +191,7 @@ for (i=0; i < sizeof(images) / sizeof(images[0]); i++) { if (strcmp(image, images[i].name) == 0) { if (images[i].image == NULL) { - images[i].image = MALLOC(sizeof(pixmap_t)); + images[i].image = malloc(sizeof(pixmap_t)); } sprintf(dirspec,"/Extra/Themes/%s/%s.png", theme_name, image); width = 0; @@ -259,10 +259,10 @@ pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height ) { - pixmap_t *cropped = MALLOC( sizeof( pixmap_t ) ); + pixmap_t *cropped = malloc( sizeof( pixmap_t ) ); if( !cropped ) return 0; - cropped->pixels = MALLOC( width * height * 4 ); + cropped->pixels = malloc( width * height * 4 ); if ( !cropped->pixels ) return 0; @@ -284,11 +284,11 @@ int createBackBuffer( window_t *window ) { - gui.backbuffer = MALLOC(sizeof(pixmap_t)); + gui.backbuffer = malloc(sizeof(pixmap_t)); if(!gui.backbuffer) return 1; - gui.backbuffer->pixels = MALLOC( window->width * window->height * 4 ); + gui.backbuffer->pixels = malloc( window->width * window->height * 4 ); if(!gui.backbuffer->pixels) { free(gui.backbuffer); @@ -304,11 +304,11 @@ int createWindowBuffer( window_t *window ) { - window->pixmap = MALLOC(sizeof(pixmap_t)); + window->pixmap = malloc(sizeof(pixmap_t)); if(!window->pixmap) return 1; - window->pixmap->pixels = MALLOC( window->width * window->height * 4 ); + window->pixmap->pixels = malloc( window->width * window->height * 4 ); if(!window->pixmap->pixels) { free(window->pixmap); @@ -916,7 +916,7 @@ struct putc_info pi; - if ((formattedtext = MALLOC(1024)) != NULL) { + if ((formattedtext = malloc(1024)) != NULL) { // format the text va_start(ap, fmt); pi.str = formattedtext; @@ -1001,7 +1001,7 @@ struct putc_info pi; - if ((formattedtext = MALLOC(1024)) != NULL) { + if ((formattedtext = malloc(1024)) != NULL) { // format the text va_start(ap, fmt); pi.str = formattedtext; @@ -1088,7 +1088,7 @@ position_t origin, cursor, bounds; font_t *font = &font_console; - if ((formattedtext = MALLOC(1024)) != NULL) { + if ((formattedtext = malloc(1024)) != NULL) { // format the text pi.str = formattedtext; pi.last_str = 0; @@ -1238,12 +1238,12 @@ { end = x + 1; - if( (font->chars[count] = MALLOC(sizeof(pixmap_t)) ) ) + if( (font->chars[count] = malloc(sizeof(pixmap_t)) ) ) { font->chars[count]->width = ( end - start) - 1; font->chars[count]->height = font->height; - if ( ( font->chars[count]->pixels = MALLOC( font->chars[count]->width * data->image->height * 4) ) ) + if ( ( font->chars[count]->pixels = malloc( font->chars[count]->width * data->image->height * 4) ) ) { space += ( font->chars[count]->width * data->image->height * 4 ); // we skip the first line because there are just the red pixels for the char width @@ -1497,7 +1497,7 @@ return; pixmap_t progressbar; - progressbar.pixels=MALLOC(width * 4 * buff->height); + progressbar.pixels=malloc(width * 4 * buff->height); if(!progressbar.pixels) return; Index: branches/rekursor/i386/boot2/ramdisk.c =================================================================== --- branches/rekursor/i386/boot2/ramdisk.c (revision 10) +++ branches/rekursor/i386/boot2/ramdisk.c (revision 11) @@ -73,8 +73,8 @@ strcpy(gRAMDiskFile, param); // Set gMI as well for the multiboot ramdisk driver hook. - gMI = gRAMDiskMI = MALLOC(sizeof(multiboot_info)); - struct multiboot_module * ramdisk_module = MALLOC(sizeof(multiboot_module)); + gMI = gRAMDiskMI = malloc(sizeof(multiboot_info)); + struct multiboot_module * ramdisk_module = malloc(sizeof(multiboot_module)); // Fill in multiboot info and module structures. if (gRAMDiskMI != NULL && ramdisk_module != NULL) Index: branches/rekursor/i386/boot2/options.c =================================================================== --- branches/rekursor/i386/boot2/options.c (revision 10) +++ branches/rekursor/i386/boot2/options.c (revision 11) @@ -631,7 +631,7 @@ { int i; MemoryRange *mp = bootInfo->memoryMap; - char *buff = MALLOC(sizeof(char)*1024); + char *buff = malloc(sizeof(char)*1024); if(!buff) return 0; char info[] = "BIOS reported memory ranges:\n"; @@ -776,12 +776,12 @@ if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) { cnt += 1; - prompt = MALLOC(cnt); + prompt = malloc(cnt); strlcpy(prompt, val, cnt); } else { - name = MALLOC(80); + name = malloc(80); getBootVolumeDescription(gBootVolume, name, 80, false); - prompt = MALLOC(256); + prompt = malloc(256); sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); cnt = 0; @@ -849,7 +849,7 @@ if (gDeviceCount) { // Allocate memory for an array of menu items. - menuItems = MALLOC(sizeof(MenuItem) * gDeviceCount); + menuItems = malloc(sizeof(MenuItem) * gDeviceCount); if (menuItems == NULL) { goto done; } @@ -1141,7 +1141,7 @@ char * configKernelFlags; char * valueBuffer; - valueBuffer = MALLOC(VALUE_SIZE); + valueBuffer = malloc(VALUE_SIZE); skipblanks( &cp ); @@ -1217,7 +1217,7 @@ val = ""; cnt = 0; } - configKernelFlags = MALLOC(cnt + 1); + configKernelFlags = malloc(cnt + 1); strlcpy(configKernelFlags, val, cnt + 1); if (processBootArgument(kBootUUIDKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, 0)) { @@ -1429,7 +1429,7 @@ if (size > MAX_TEXT_FILE_SIZE) { size = MAX_TEXT_FILE_SIZE; } - buf = MALLOC(size); + buf = malloc(size); read(fd, buf, size); close(fd); showTextBuffer(buf, size); Index: branches/rekursor/i386/libsa/libsa.h =================================================================== --- branches/rekursor/i386/libsa/libsa.h (revision 10) +++ branches/rekursor/i386/libsa/libsa.h (revision 11) @@ -126,9 +126,9 @@ /* * zalloc.c */ -#define MALLOC(size) malloc(size, __FILE__, __LINE__) +#define malloc(size) safe_malloc(size, __FILE__, __LINE__) extern void malloc_init(char * start, int size, int nodes, void (*malloc_error)(char *, size_t, const char *, int)); -extern void * malloc(size_t size,const char *file, int line); +extern void * safe_malloc(size_t size,const char *file, int line); extern void free(void * start); extern void * realloc(void * ptr, size_t size); Index: branches/rekursor/i386/libsa/zalloc.c =================================================================== --- branches/rekursor/i386/libsa/zalloc.c (revision 10) +++ branches/rekursor/i386/libsa/zalloc.c (revision 11) @@ -86,7 +86,7 @@ #define BEST_FIT 1 -void * malloc(size_t size, const char *file, int line) +void * safe_malloc(size_t size, const char *file, int line) { int i; #if BEST_FIT @@ -315,7 +315,7 @@ /* This is the simplest way possible. Should fix this. */ void * realloc(void * start, size_t newsize) { - void * newstart = malloc(newsize, __FILE__, __LINE__); + void * newstart = safe_malloc(newsize, __FILE__, __LINE__); bcopy(start, newstart, newsize); free(start); return newstart;