~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to qemu-malloc.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
static void *oom_check(void *ptr)
28
28
{
29
 
    if (ptr == NULL)
 
29
    if (ptr == NULL) {
30
30
        abort();
 
31
    }
31
32
    return ptr;
32
33
}
33
34
 
43
44
 
44
45
void *qemu_malloc(size_t size)
45
46
{
 
47
    if (!size) {
 
48
        abort();
 
49
    }
46
50
    return oom_check(malloc(size));
47
51
}
48
52
 
49
53
void *qemu_realloc(void *ptr, size_t size)
50
54
{
51
 
    if (size)
 
55
    if (size) {
52
56
        return oom_check(realloc(ptr, size));
53
 
    else
54
 
        return realloc(ptr, size);
 
57
    } else {
 
58
        if (ptr) {
 
59
            return realloc(ptr, size);
 
60
        }
 
61
    }
 
62
    abort();
55
63
}
56
64
 
57
65
void *qemu_mallocz(size_t size)
76
84
    const char *end = memchr(str, 0, size);
77
85
    char *new;
78
86
 
79
 
    if (end)
 
87
    if (end) {
80
88
        size = end - str;
 
89
    }
81
90
 
82
91
    new = qemu_malloc(size + 1);
83
92
    new[size] = 0;