[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Towards a cleaner build: bindat
From: |
Eli Zaretskii |
Subject: |
Re: Towards a cleaner build: bindat |
Date: |
Sat, 15 Jun 2019 17:22:30 +0300 |
> From: Lars Ingebrigtsen <address@hidden>
> Date: Sat, 15 Jun 2019 16:04:08 +0200
>
> ((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?
Yes. You should create the string by calling unibyte-string.
- Re: Towards a cleaner build: rmailmm, (continued)
- Re: Towards a cleaner build: rmailmm, Stefan Monnier, 2019/06/14
- Re: Towards a cleaner build: rmailmm, Lars Ingebrigtsen, 2019/06/14
- 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, 2019/06/15
- Re: Towards a cleaner build: bindat,
Eli Zaretskii <=
- 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
- Re: Towards a cleaner build: srecode/insert, Lars Ingebrigtsen, 2019/06/16