summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-09-04 15:19:21 -0700
committerAndrea Canciani <ranma42@gmail.com>2011-09-04 16:23:37 -0700
commit6ad63946d4374ad30ef7fbdad421d85bfd8da423 (patch)
treed7db5db522c727ea9cc0533c66f7109a3397aa4d /util
parented84cb522cc9a65ac89b2b008010ecfe78dde7de (diff)
cairo-missing: Fix build
The cairo-missing code contains multiple typos and uses _cairo_*alloc*() functions without including cairo-malloc-private.h
Diffstat (limited to 'util')
-rw-r--r--util/cairo-missing/Makefile.win324
-rw-r--r--util/cairo-missing/getline.c9
-rw-r--r--util/cairo-missing/strndup.c7
3 files changed, 12 insertions, 8 deletions
diff --git a/util/cairo-missing/Makefile.win32 b/util/cairo-missing/Makefile.win32
index ac24a2c3d..c2c5bc01e 100644
--- a/util/cairo-missing/Makefile.win32
+++ b/util/cairo-missing/Makefile.win32
@@ -6,5 +6,5 @@ all: inform $(CFG)/libcairo-missing.lib
libcairo_missing_OBJECTS = $(patsubst %.c, $(CFG)/%-static.obj, $(libcairo_missing_sources))
-$(CFG)/libcairo-script-interpreter.lib: $(libcairo_missing_OBJECTS)
- @$(AR) $(CAIRO_ARFLAGS) -OUT:$@ $(libcairo_missing_OBJECTS)
+$(CFG)/libcairo-missing.lib: $(libcairo_missing_OBJECTS)
+ @$(AR) $(CAIRO_ARFLAGS) -OUT:$@ $^
diff --git a/util/cairo-missing/getline.c b/util/cairo-missing/getline.c
index 584c6ace4..8585cfdc2 100644
--- a/util/cairo-missing/getline.c
+++ b/util/cairo-missing/getline.c
@@ -31,6 +31,7 @@
#include "cairo-missing.h"
#ifndef HAVE_GETLINE
+#include "cairo-malloc-private.h"
#define GETLINE_MIN_BUFFER_SIZE 128
ssize_t
@@ -45,20 +46,20 @@ getline (char **lineptr,
offset = 0;
len = *n;
line = *lineptr;
- if (len < GETLINE_BUFFER_SIZE) {
- len = GETLINE_BUFFER_SIZE;
+ if (len < GETLINE_MIN_BUFFER_SIZE) {
+ len = GETLINE_MIN_BUFFER_SIZE;
line = NULL;
}
if (line == NULL) {
- line = (char *) malloc (len);
+ line = (char *) _cairo_malloc (len);
if (unlikely (line == NULL))
return -1;
}
while (1) {
if (offset + 1 == len) {
- tmpline = (char *) cairo_realloc (line, len, 2);
+ tmpline = (char *) _cairo_realloc_ab (line, len, 2);
if (unlikely (tmpline == NULL)) {
if (line != *lineptr)
free (line);
diff --git a/util/cairo-missing/strndup.c b/util/cairo-missing/strndup.c
index 6eabc12d0..280ea3017 100644
--- a/util/cairo-missing/strndup.c
+++ b/util/cairo-missing/strndup.c
@@ -31,6 +31,8 @@
#include "cairo-missing.h"
#ifndef HAVE_STRNDUP
+#include "cairo-malloc-private.h"
+
char *
strndup (const char *s,
size_t n)
@@ -42,8 +44,9 @@ strndup (const char *s,
return NULL;
len = strlen (s);
- len = MIN (n, len);
- sdup = (char *) malloc (len + 1);
+ if (len > n)
+ len = n;
+ sdup = (char *) _cairo_malloc (len + 1);
if (sdup != NULL) {
memcpy (sdup, s, len);
sdup[len] = '\0';