#include <time.h>
#include <limits.h>
+#include "xalloc.h"
#include "nls.h"
#include "rpmatch.h"
#include "blkdev.h"
_("BLKGETSIZE ioctl failed on %s\n"),
disk_device);
break;
- case out_of_memory:
- message = _("Unable to allocate any more memory\n");
- break;
default:
message = _("Fatal error\n");
}
struct pte *pe = &ptes[pno];
pe->offset = offset;
- pe->sectorbuffer = malloc(sector_size);
- if (!pe->sectorbuffer)
- fatal(out_of_memory);
+ pe->sectorbuffer = xmalloc(sector_size);
read_sector(fd, offset, pe->sectorbuffer);
pe->changed = 0;
pe->part_table = pe->ext_pointer = NULL;
if (MBRbuffer)
return;
- MBRbuffer = calloc(1, MAX_SECTOR_SIZE);
- if (!MBRbuffer)
- fatal(out_of_memory);
+ MBRbuffer = xcalloc(1, MAX_SECTOR_SIZE);
}
void zeroize_mbr_buffer(void)
if (!ms || strlen(mesg)+100 > mslen) {
mslen = strlen(mesg)+200;
- if (!(ms = realloc(ms,mslen)))
- fatal(out_of_memory);
+ ms = xrealloc(ms,mslen);
}
if (dflt < low || dflt > high)
ext_index = n;
pen->ext_pointer = p;
pe4->offset = extended_offset = start;
- if (!(pe4->sectorbuffer = calloc(1, sector_size)))
- fatal(out_of_memory);
+ pe4->sectorbuffer = xcalloc(1, sector_size);
pe4->part_table = pt_offset(pe4->sectorbuffer, 0);
pe4->ext_pointer = pe4->part_table + 1;
pe4->changed = 1;
if (partitions > 5 || ptes[4].part_table->sys_ind) {
struct pte *pe = &ptes[partitions];
- if (!(pe->sectorbuffer = calloc(1, sector_size)))
- fatal(out_of_memory);
+ pe->sectorbuffer = xcalloc(1, sector_size);
pe->part_table = pt_offset(pe->sectorbuffer, 0);
pe->ext_pointer = pe->part_table + 1;
pe->offset = 0;
enum failure {ioctl_error,
unable_to_open, unable_to_read, unable_to_seek,
- unable_to_write, out_of_memory};
+ unable_to_write};
enum action {fdisk, require, try_only, create_empty_dos, create_empty_sun};