This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [LIBIBERTY]: Add strndup and xstrndup functions


"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:

> -	xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
> +	xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c	\
> +	xstrndup.c

The custom is to indent the subsequent lines starting with the same
letter by a space, so there should be a space before xstrndup.o.

>  	./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o	\
> -	 ./xstrerror.o
> +	./xstrerror.o ./xstrndup.o

Don't remove the space before xstrerror.o.
> +@deftypefn Extension char* strndup (const char *@var{s}, size_t @var{n})
> +
> +Returns a pointer to a copy of @var{s} with at most @var{n} characters
> +in memory obtained from @code{malloc}, or @code{NULL} if insufficient
> +memory was available.  The result is always @code{NULL} terminated.

It's not NULL terminated--NULL is conventionally a pointer constant.
It's NUL terminated, or terminated by '\0', or something.

> +@deftypefn Replacement char* xstrndup (const char *@var{s}, size_t @var{n})
> +
> +Returns a pointer to a copy of @var{s} with at most @var{n} characters
> +without fail, using @code{xmalloc} to obtain memory.  The result is
> +always @code{NULL} terminated.

Likewise.

OK with those changes.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]