summaryrefslogtreecommitdiff
path: root/perf/cairo-perf-trace.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-08-30 16:16:04 +0200
committerAndrea Canciani <ranma42@gmail.com>2011-09-02 12:27:13 +0200
commit6d6bfbd641bbb4de62df704e724e507a7e55b883 (patch)
tree9a1b624ce3c02b59c67865f6743caf37b86ed2cb /perf/cairo-perf-trace.c
parent0101a545793291d0fe76b765ba8392ade5faa1a1 (diff)
downloadcairo-6d6bfbd641bbb4de62df704e724e507a7e55b883.tar.gz
Introduce the cairo-missing library
The cairo-missing library provides the functions which are needed in order to correctly compile cairo (or its utilities) and which were not found during configuration. Fixes the build on MacOS X Lion, which failed because of collisons between the cairo internal getline and strndup and those in libc: cairo-analyse-trace.c:282: error: static declaration of ‘getline’ follows non-static declaration /usr/include/stdio.h:449: error: previous declaration of ‘getline’ was here cairo-analyse-trace.c:307: error: static declaration of ‘strndup’ follows non-static declaration ...
Diffstat (limited to 'perf/cairo-perf-trace.c')
-rw-r--r--perf/cairo-perf-trace.c52
1 files changed, 1 insertions, 51 deletions
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 25a98f34c..3319917f8 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -32,6 +32,7 @@
#include "../cairo-version.h" /* for the real version */
+#include "cairo-missing.h"
#include "cairo-perf.h"
#include "cairo-stats.h"
@@ -373,57 +374,6 @@ usage (const char *argv0)
argv0, argv0);
}
-#ifndef __USE_GNU
-#define POORMANS_GETLINE_BUFFER_SIZE (65536)
-static ssize_t
-getline (char **lineptr,
- size_t *n,
- FILE *stream)
-{
- if (!*lineptr)
- {
- *n = POORMANS_GETLINE_BUFFER_SIZE;
- *lineptr = (char *) malloc (*n);
- }
-
- if (!fgets (*lineptr, *n, stream))
- return -1;
-
- if (!feof (stream) && !strchr (*lineptr, '\n'))
- {
- fprintf (stderr, "The poor man's implementation of getline in "
- __FILE__ " needs a bigger buffer. Perhaps it's "
- "time for a complete implementation of getline.\n");
- exit (0);
- }
-
- return strlen (*lineptr);
-}
-#undef POORMANS_GETLINE_BUFFER_SIZE
-
-static char *
-strndup (const char *s,
- size_t n)
-{
- size_t len;
- char *sdup;
-
- if (!s)
- return NULL;
-
- len = strlen (s);
- len = (n < len ? n : len);
- sdup = (char *) malloc (len + 1);
- if (sdup)
- {
- memcpy (sdup, s, len);
- sdup[len] = '\0';
- }
-
- return sdup;
-}
-#endif /* ifndef __USE_GNU */
-
static cairo_bool_t
read_excludes (cairo_perf_t *perf,
const char *filename)