Additional glib function thoughts.



I have a few thoughts on new glib functionality:

1. There needs to be more control over out-of-memory (OOM) situations.
   The docs say "If any call to allocate memory fails,
   the application is terminated."  This is terrible; sometimes an application
   will want more control over out-of-memory (e.g., try something else,
   drop that request but continue processing, undo some actions, etc.),
   and language binding implementors may need one to handle OOM correctly.
   At the least, a way to "hook" in a function to be called on OOM situation
   (like C++) would be something.  Has anyone tried this?  Suggestions?

2. Would anyone object to ensuring that GString can be used with
   embedded NUL characters (and documenting this)?  Sometimes it's handy
   to be able to slurp in large amounts of binary data with embedded text.
   GByteArray doesn't have all those nice support functions like
   g_string_sprintfa.  This ability is sometimes very handy in Perl.
   Yes, you have to be careful extracting data out, but that'd be true anyway,
   and documenting this gives the programmer a choice.

3. Gstring is missing an "fgets"-like function to read in a line;
   it'd be handy for reading in "a line at a time".  Am I missing it?

4. I'd like to mention Gstring as a possible solution for secure code.
   Has anyone "gone over"/audited the Gstring code?  This requires controlling
   the OOM situation noted above.


-- 

--- David A. Wheeler
    dwheeler@ida.org



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]