[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: add a string-desc module
From: |
Bruno Haible |
Subject: |
Re: RFC: add a string-desc module |
Date: |
Wed, 29 Mar 2023 00:49:40 +0200 |
Simon Josefsson wrote:
> I think this is a useful contribution,
Thanks.
> however I see two deal-breakers
> for having it in gnulib -- both related to use in libraries. I think
> string helpers types/functions like this is useful not only in
> applications but also in libraries. Thus:
>
> 1) License - there really isn't much novelty here, how about making
> this public domain or LGPLv2+?
Not public domain — it does not protect the user from patent claims.
Not MIT license — I don't intend to make gifts to proprietary software
vendors. It's bad enough that some companies ignore the requirements
of the GPL. <https://www.youtube.com/watch?v=5rgsXq2e7Ck>
I've put the core module under LGPLv3+.
If you want it under LGPLv2+, it would be OK for my part, but we would
have to relax the 'memrchr' module to LGPLv2+ first.
> 2) Applicability to use in a library - using x*alloc and abort is
> frowned upon in libraries. Libraries should return error codes on
> expected errors (and I argue memory allocation failure is an expected
> error), and not cause application exits.
Done by separating library-safe memory allocations and checked memory
allocations into separate modules.
> One way to resolve 2) is to have two variants of this functionality: one
> low-level variant that doesn't abort the application on errors, and one
> high-level variant that behaves like your implementation. The
> high-level variant could depend on the low-level variant, but that's not
> essential.
Yes, that's how I did it, for the most part. I couldn't do this so easily
for the string_desc_concat function, though, due to varargs.
Bruno