liblangtag: fix 0.4.0 breakages on Mac

Change-Id: I354d82a86e4e45d49578ccea083d258f1660b60e
This commit is contained in:
Norbert Thiebaud 2012-11-06 09:58:02 -06:00
parent 8bd7e9a168
commit 2e0b4a7304
2 changed files with 127 additions and 2 deletions

View file

@ -0,0 +1,123 @@
diff -r -u liblangtag-0.4.0.org/data/reg2xml.c liblangtag-0.4.0/data/reg2xml.c
--- misc/liblangtag-0.4.0.org/data/reg2xml.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/data/reg2xml.c 2012-11-06 09:33:59.000000000 -0600
@@ -111,7 +111,9 @@
fsetpos(fp, &pos);
}
token = strstr(buffer, ": ");
- tag = strndup(buffer, token - buffer);
+ tag = malloc((token-buffer) + 1);
+ strncpy(tag, buffer, token-buffer);
+ tag[token-buffer] = 0;
token += 2;
xmlNewChild(ent, NULL,
(const xmlChar *)lt_strlower(tag),
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-atomic.h liblangtag-0.4.0/liblangtag/lt-atomic.h
--- misc/liblangtag-0.4.0.org/liblangtag/lt-atomic.h 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-atomic.h 2012-11-06 09:24:15.000000000 -0600
@@ -93,7 +93,7 @@
{
lt_bool_t retval;
- lt_return_if_fail (v != NULL, FALSE);
+ lt_return_val_if_fail (v != NULL, FALSE);
pthread_mutex_lock(&__lt_atomic_lock);
retval = --(*v) == 0;
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-error.c liblangtag-0.4.0/liblangtag/lt-error.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-error.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-error.c 2012-11-06 09:18:23.000000000 -0600
@@ -14,7 +14,6 @@
#include "config.h"
#endif
-#include <execinfo.h>
#include <stdlib.h>
#include "lt-list.h"
#include "lt-mem.h"
@@ -98,9 +97,7 @@
...)
{
va_list ap;
- void *traces[1024];
lt_error_data_t *d = lt_mem_alloc_object(sizeof (lt_error_data_t));
- int size;
lt_bool_t allocated;
lt_return_val_if_fail (error != NULL, NULL);
@@ -117,10 +114,7 @@
d->message = lt_strdup_vprintf(message, ap);
va_end(ap);
- size = backtrace(traces, 1024);
- if (size > 0)
- d->traces = backtrace_symbols(traces, size);
- d->stack_size = size;
+ d->stack_size = 0;
lt_mem_add_ref(&d->parent, d->message, free);
lt_mem_add_ref(&d->parent, d->traces, free);
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-ext-module.c liblangtag-0.4.0/liblangtag/lt-ext-module.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-ext-module.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-ext-module.c 2012-11-06 09:30:31.000000000 -0600
@@ -399,7 +399,8 @@
if (len > suffix_len &&
lt_strcmp0(&filename[prefix_len + len - suffix_len], "." LT_MODULE_SUFFIX) == 0) {
- module = strndup(&filename[prefix_len], len - suffix_len);
+ module = malloc((len-suffix_len) + 1);
+ strncpy(module, &filename[prefix_len], len-suffix_len);
module[len - suffix_len] = 0;
}
}
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-messages.c liblangtag-0.4.0/liblangtag/lt-messages.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-messages.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-messages.c 2012-11-06 09:20:58.000000000 -0600
@@ -17,7 +17,6 @@
#include "config.h"
#endif
-#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -98,27 +97,6 @@
static void
_lt_message_stacktrace(void)
{
- void *traces[1024];
- char **strings;
- int size, i;
-
- size = backtrace(traces, 1024);
- if (size > 0) {
- strings = backtrace_symbols(traces, size);
- lt_debug(LT_MSGCAT_TRACE, "Stacktrace:");
- /*
- * XXX:
- * 0.. here.
- * 1.. _lt_message_default_handler
- * 2.. lt_message_vprintf
- * 3.. lt_message_printf
- * 4.. lt_* macros
- */
- for (i = 4; i < size; i++) {
- lt_debug(LT_MSGCAT_TRACE, " %d. %s", i - 3, strings[i]);
- }
- free(strings);
- }
}
static void
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-utils.c liblangtag-0.4.0/liblangtag/lt-utils.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-utils.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-utils.c 2012-11-06 09:23:36.000000000 -0600
@@ -14,6 +14,7 @@
#include "config.h"
#endif
+#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>

View file

@ -36,7 +36,9 @@ TARFILE_MD5=54e578c91b1b68e69c72be22adcb2195
PATCH_FILES=liblangtag-0.4.0-msvc-warning.patch
PATCH_FILES+=liblangtag-0.4.0-reg2xml-encoding-problem.patch
.IF "$(OS)" == "MACOSX"
PATCH_FILES=liblangtag-0.4.0-mac.patch
.END
CONFIGURE_DIR=.
BUILD_DIR=$(CONFIGURE_DIR)
CONFIGURE_FLAGS= --disable-modules
@ -69,7 +71,7 @@ CONFIGURE_FLAGS+= LIBXML2_LIBS='-L$(SOLARLIBDIR) -lxml2'
.ENDIF
.ELSE
.IF "$(OS)" == "MACOSX"
CONFIGURE_FLAGS+= LIBXML2_CFLAGS='$(LIBXML_CFLAGS)' LIBXML2_LIBS='$(LIBXML_LIBS)'
CONFIGURE_FLAGS+= LIBXML2_CFLAGS='$(LIBXML_CFLAGS)' LIBXML2_LIBS='$(LIBXML_LIBS)' --disable-modules
.ENDIF
.ENDIF