On Mon, Dec 18, 2023 at 11:44:22AM +0800, YunQiang Su wrote:
> For reconcat, if the `optr` can only be used as the last one
> of string list, aka, we cannot append something to it.
> Let's add some note into the document.
> 
> libiberty:
>       * concat.c (reconcat): Add note about append string to NULL
>       into document.
> ---
>  libiberty/concat.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libiberty/concat.c b/libiberty/concat.c
> index 4cb1df3baf3..3a6b4ca71e8 100644
> --- a/libiberty/concat.c
> +++ b/libiberty/concat.c
> @@ -169,6 +169,9 @@ loop:
>    str = reconcat (str, "pre-", str, NULL);
>  @end example
>  
> +Note: don't try to append string(s) to the a NULL string,
> +as the process will stop at the first NULL argument.
> +
>  @end deftypefn

I think this is unnecessary and misleading.
The fact that NULL is the variable argument terminator is already clearly
documented, and first argument to reconcat can be NULL just fine,
so one just needs to be careful.

        Jakub

Reply via email to