[cairo] Re: Add missing prototypes for getline and strndup commit (Was: [cairo-commit] 4 commits - perf/cairo-perf-diff-files.c pixman/src src/Makefile.am)

Behdad Esfahbod behdad at behdad.org
Sat Apr 28 15:26:53 PDT 2007


On Sat, 2007-04-28 at 10:46 -0400, Carl Worth wrote:
> New commits:
> diff-tree 7e6ab5461c2eb75c948bcb4725613ebe826c697a (from
> 422798db1d73c1a8ecc5877133b0325023f38e61)
> Author: Carl Worth <cworth at cworth.org>
> Date:   Sat Apr 28 07:46:56 2007 -0700
> 
>     Add missing prototypes for getline and strndup
>     
>     This is needed to prevent breaking the build for non-GNU systems.
> 
> diff --git a/perf/cairo-perf-diff-files.c
> b/perf/cairo-perf-diff-files.c
> index 108940d..2fd6229 100644
> --- a/perf/cairo-perf-diff-files.c
> +++ b/perf/cairo-perf-diff-files.c
> @@ -94,6 +94,14 @@ typedef struct _cairo_perf_diff_files_ar
>      cairo_perf_report_options_t options;
>  } cairo_perf_diff_files_args_t;
>  
> +#ifndef __USE_GNU
> +static ssize_t
> +getline (char **lineptr, size_t *n, FILE *stream);
> +
> +static char *
> +strndup (const char *s, size_t n);
> +#endif
> +
>  /* Ad-hoc parsing, macros with a strong dependence on the calling
>   * context, and plenty of other ugliness is here.  But at least it's
>   * not perl... */
> @@ -248,7 +256,7 @@ test_report_parse (test_report_t *report
>   */
>  #ifndef __USE_GNU
>  #define POORMANS_GETLINE_BUFFER_SIZE (65536)
> -ssize_t
> +static ssize_t
>  getline (char **lineptr, size_t *n, FILE *stream)
>  {
>      if (!*lineptr)
> @@ -272,7 +280,7 @@ getline (char **lineptr, size_t *n, FILE
>  }
>  #undef POORMANS_GETLINE_BUFFER_SIZE
>  
> -char *
> +static char *
>  strndup (const char *s, size_t n)
>  {
>      size_t len; 

Humm, the patch "also" does things that it doesn't specify in the commit
log.  Bad cworth :>.  It's an either/or btw, if you declare those two
static, no need to prototype them, so you can remove the hardly-not-ugly
prototypes-wrapped-in-an-ifdef.

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list