[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: add a string-desc module
From: |
Simon Josefsson |
Subject: |
Re: RFC: add a string-desc module |
Date: |
Mon, 27 Mar 2023 12:15:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Bruno Haible <bruno@clisp.org> writes:
> struct
> {
> size_t nbytes;
> char * data;
> }
>
> I propose to add a module that adds such a type, together with elementary
> functions that work on them.
I think this is a useful contribution, 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+?
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.
What do you think?
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.
/Simon
signature.asc
Description: PGP signature