bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#56048: [PATCH] bindat (strz): Null terminate fixed-length strings if


From: Richard Hansen
Subject: bug#56048: [PATCH] bindat (strz): Null terminate fixed-length strings if there is room
Date: Sat, 18 Jun 2022 18:57:23 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

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

Attachment: v3-0001-bindat-strz-Move-all-pack-logic-to-pack-function.patch
Description: Text Data

Attachment: v3-0002-bindat-strz-Null-terminate-fixed-length-strings-i.patch
Description: Text Data

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]