From 1d2d67cdde13f484d8a6173a3b8fc2c6739c860d Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Mon, 7 Feb 2011 03:56:15 +0000 Subject: [PATCH] strdup still not accepted by some systems. *sigh*. --- code/qcommon/vm_x86_64_assembler.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/qcommon/vm_x86_64_assembler.c b/code/qcommon/vm_x86_64_assembler.c index b5e79f98..9c6c5c69 100644 --- a/code/qcommon/vm_x86_64_assembler.c +++ b/code/qcommon/vm_x86_64_assembler.c @@ -241,12 +241,15 @@ static void hash_add_label(const char* label, unsigned address) { struct hashentry* h; unsigned i = hashkey(label, -1U); + int labellen; i %= sizeof(labelhash)/sizeof(labelhash[0]); h = malloc(sizeof(struct hashentry)); - h->label = strdup(label); - + labellen = strlen(label) + 1; + h->label = malloc(labellen); + memcpy(h->label, label, labellen); + h->address = address; h->next = labelhash[i]; labelhash[i] = h;