[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Towards a cleaner build: bindat
From: |
Lars Ingebrigtsen |
Subject: |
Re: Towards a cleaner build: bindat |
Date: |
Sat, 15 Jun 2019 16:04:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
We're on the home stretch now...
In bindat--unpack-item:
emacs-lisp/bindat.el:267:10:Warning: `string-make-unibyte' is an obsolete
function (as of 26.1); use `encode-coding-string'.
emacs-lisp/bindat.el:264:62:Warning: `string-make-unibyte' is an obsolete
function (as of 26.1); use `encode-coding-string'.
It's this code:
((eq type 'str)
(let ((s (substring bindat-raw bindat-idx (+ bindat-idx len))))
(setq bindat-idx (+ bindat-idx len))
(if (stringp s) s
(string-make-unibyte (concat s)))))
((eq type 'strz)
(let ((i 0) s)
(while (and (< i len) (/= (aref bindat-raw (+ bindat-idx i)) 0))
(setq i (1+ i)))
(setq s (substring bindat-raw bindat-idx (+ bindat-idx i)))
(setq bindat-idx (+ bindat-idx len))
(if (stringp s) s
(string-make-unibyte (concat s)))))
s is either a string or a vector, and if it's a vector, we transform it
to a unibyte string by running it through concat and
string-make-unibyte.
But as far as I can tell from poking at the code, the vector will always
be a vector of byte values; i.e., in the 0-255 region. concat, indeed,
returns a multibyte string:
(multibyte-string-p (concat [250 255]))
=> t
So if we just avoid the concat and make a unibyte string from the vector
in, well, just about any other way, then the string-make-unibyte
should be unnecessary, right?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Re: Towards a cleaner build: rmailmm, (continued)
- Re: Towards a cleaner build: eieio, Lars Ingebrigtsen, 2019/06/13
- Re: Towards a cleaner build: eieio, Stefan Monnier, 2019/06/13
- Re: Towards a cleaner build: eieio, Lars Ingebrigtsen, 2019/06/14
- Re: Towards a cleaner build: eieio, Stefan Monnier, 2019/06/14
- Re: Towards a cleaner build: eieio, Lars Ingebrigtsen, 2019/06/14
- Re: Towards a cleaner build: eieio, Stefan Monnier, 2019/06/14
- Re: Towards a cleaner build: eieio, Lars Ingebrigtsen, 2019/06/15
- Re: Towards a cleaner build: bindat,
Lars Ingebrigtsen <=
- Re: Towards a cleaner build: bindat, Eli Zaretskii, 2019/06/15
- Re: Towards a cleaner build: bindat, Lars Ingebrigtsen, 2019/06/15
- Re: Towards a cleaner build: bindat, Lars Ingebrigtsen, 2019/06/15
- Re: Towards a cleaner build: bindat, Eli Zaretskii, 2019/06/15
- Re: Towards a cleaner build: feedmail, Lars Ingebrigtsen, 2019/06/15
- Re: Towards a cleaner build: feedmail, Eli Zaretskii, 2019/06/15
- Re: Towards a cleaner build: feedmail, Lars Ingebrigtsen, 2019/06/15
- Re: Towards a cleaner build: tags, Lars Ingebrigtsen, 2019/06/15
- Re: Towards a cleaner build: srecode/insert, Lars Ingebrigtsen, 2019/06/15
- Re: Towards a cleaner build: srecode/insert, Eric Ludlam, 2019/06/16