Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #60372

Re: Please critique my strdupf library

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: Please critique my strdupf library
Date 2015-04-19 20:46 +1200
Message-ID <cph8b1Fl1o8U10@mid.individual.net> (permalink)
References <6df1a933-2ba8-41f6-a169-f622244f0b66@googlegroups.com>

Show all headers | View raw


samuelallenalexander@gmail.com wrote:
> Dear comp.lang.c,
>
> I wrote a tiny little library to implement "strdupf", now I don't know how I ever lived without it.  strdupf is like strdup, except it takes printf-style variadic format arguments instead of a single string argument.
>
> The library is here: https://github.com/semitrivial/mallocf
>
> Please critique the library, in particular I'm concerned about:
>
> * Portability: Have I accidentally relied on anything implementation-dependent?
>
> * Correctness: Have I committed any glaring sins against C?
>
> * Style: Aside from my signature 2-space indents, have I committed any stylistic sins?
>
> Is there anything you can see that would further improve the library?

What is the reason for the macros at the top of mallocf.c?  va_copy and 
va_end are standard.

One classic: sizeof(char) is one by definition.

-- 
Ian Collins

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Please critique my strdupf library samuelallenalexander@gmail.com - 2015-04-19 01:34 -0700
  Re: Please critique my strdupf library Ian Collins <ian-news@hotmail.com> - 2015-04-19 20:46 +1200
    Re: Please critique my strdupf library samuelallenalexander@gmail.com - 2015-04-19 02:25 -0700
      Re: Please critique my strdupf library Ian Collins <ian-news@hotmail.com> - 2015-04-19 21:35 +1200
        Re: Please critique my strdupf library Keith Thompson <kst-u@mib.org> - 2015-04-19 07:44 -0700
          Re: Please critique my strdupf library samuelallenalexander@gmail.com - 2015-04-19 10:23 -0700
            Re: Please critique my strdupf library Morris Dovey <mrdovey@iedu.com> - 2015-04-19 13:09 -0500
      Re: Please critique my strdupf library fir <profesor.fir@gmail.com> - 2015-04-19 02:48 -0700
        Re: Please critique my strdupf library samuelallenalexander@gmail.com - 2015-04-19 03:42 -0700
  Re: Please critique my strdupf library fir <profesor.fir@gmail.com> - 2015-04-19 02:11 -0700
  Re: Please critique my strdupf library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-19 11:11 +0100
    Re: Please critique my strdupf library samuelallenalexander@gmail.com - 2015-04-19 04:36 -0700
      Re: Please critique my strdupf library Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 15:41 +0200
        Re: Please critique my strdupf library samuelallenalexander@gmail.com - 2015-04-19 07:28 -0700
  Re: Please critique my strdupf library August Karlstrom <fusionfile@gmail.com> - 2015-04-19 12:12 +0200
  Re: Please critique my strdupf library Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 13:25 +0200
    Re: Please critique my strdupf library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-19 13:32 +0100
  Re: Please critique my strdupf library Lőrinczy Zsigmond <nospam@for.me> - 2015-04-19 16:29 +0200
  Re: Please critique my strdupf library Keith Thompson <kst-u@mib.org> - 2015-04-19 07:52 -0700

csiph-web