GNU bug report logs - #56048
[PATCH] bindat (strz): Null terminate fixed-length strings if there is room

Previous Next

Package: emacs;

Reported by: Richard Hansen <rhansen <at> rhansen.org>

Date: Fri, 17 Jun 2022 22:54:02 UTC

Severity: wishlist

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 56048 <at> debbugs.gnu.org (full text, mbox):

From: Richard Hansen <rhansen <at> rhansen.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 56048 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#56048: [PATCH] bindat (strz): Null terminate fixed-length
 strings if there is room
Date: Sat, 18 Jun 2022 18:57:23 -0400
[Message part 1 (text/plain, inline)]
On 2022-06-18 02:32, Eli Zaretskii wrote:
>> Subject: [PATCH v2 1/2] ; bindat (strz): Move all pack logic to pack function
> 
> What is the motivation/rationale for this refactoring?

The attached revision updates the commit message to explain:

    ; bindat (strz): Move all pack logic to pack function

    Motivation/rationale:
      * Improve code readability.  Now `bindat--pack-strz` is used for all
        `strz` packing, not just variable-length `strz` packing.
      * Make it easier to change the behavior of fixed-length `strz`
        packing without also affecting the behavior of `str` packing.  (A
        future commit will modify `strz` to write a null terminator if
        there is room.)

> 
>> +When packing, a null terminator is written after the packed string if
>> +the length of the input string is less than @var{len}.
> 
> Since "length of a string" is highly ambiguous in Emacs, please always
> make a point of saying "@var{len} bytes" explicitly.  Byte length is
> something rarely seen or used in Emacs, so people must be informed
> about that each time.

Done; see attached revision.

Thanks,
Richard
[v3-0001-bindat-strz-Move-all-pack-logic-to-pack-function.patch (text/x-patch, attachment)]
[v3-0002-bindat-strz-Null-terminate-fixed-length-strings-i.patch (text/x-patch, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

This bug report was last modified 3 years and 22 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.