From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Towards a cleaner build: bindat Date: Sat, 15 Jun 2019 16:04:08 +0200 Message-ID: References: <83a7eo9nsh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="220096"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 15 16:05:23 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hc9J4-000v8I-PE for ged-emacs-devel@m.gmane.org; Sat, 15 Jun 2019 16:05:22 +0200 Original-Received: from localhost ([::1]:60744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hc9J3-00065z-Pt for ged-emacs-devel@m.gmane.org; Sat, 15 Jun 2019 10:05:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52917) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hc9I4-00065t-Jd for emacs-devel@gnu.org; Sat, 15 Jun 2019 10:04:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hc9Hy-00068u-S5 for emacs-devel@gnu.org; Sat, 15 Jun 2019 10:04:18 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:59924) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hc9Hy-00066u-5c for emacs-devel@gnu.org; Sat, 15 Jun 2019 10:04:14 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hc9Hs-0007Dl-8z for emacs-devel@gnu.org; Sat, 15 Jun 2019 16:04:10 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEWqra7Z2tr////+//75 +fnt7e0mEygKAAACcUlEQVQ4jXVUy5KjMAyUM3CXAr6H1z0kzB2CfLcT9P+/sm2Y1NZma3wyaqvV kttQ+8uiX4GGnh+hXg9AHsd3pz8b2x47cP6Jh7Dum2GzVwYuXwcQVDVs2IzfanuGe+znc9zGR2ba duCyFw+brrq8NvBWm6bHDuCjN5t09RZ8OzgLihANBuLFZNPJB0236FwYqj2Dnr2E5HVBRnoyM23+ p3OEkmzJNls8RXbOHUAvZolIABiTiHMQlIHBiyUwSC2JiWcmCKIEtWbbzELuZUZOUqSc8YDowSwy TlZmjrw4Ag8oy7ZL4B5x0BZiLgvKxZt6fvZZjAiRi6gRhTE/Gi++VE3IvCIKFodqp0zVVLypUozj FcogVZjzrJJcU6kriS89UYl+Ysw9kM1NTZtSURQ4fWoTksp2pxKJRXCl5OMgb8ifjjuXOVGAzHm5 8il7YXdBrgGxULMsSTgbQA+XyGhVSVApImkG0HW3++3W0lKfzzXGRkWJEWJwzI5d0VJ1OtfCNCPF VwyOy5WYypZOVeJ5JAyr/hJ6A8jwC8ckpBNJOku+tkknmDLLlNJR1t8IptrOUkiJDFp8hcHClbFs stNmKikXJ1+I1Gw36HG5jfgGasQdazZyd1im9j4DiJfGGpDSShpTssW0bim6qkDLOmWnY+boFX5B hoHLM6tOGJ07AJZTS98xWrHM2q14N2dOMGJscvE2OaREZOjHqx2YVhfXvl9vH885OX9Oqut6G9TU 7uuk/Q70WcX6WBVTea+v3dSB2Yfwt8TlDXTT674/ZLMQtqDBp+c/v4xL7i17keCWj39JQ7zX+A/o 7vf7pFu+qPaX9Qf/wZ/svmEzWwAAAABJRU5ErkJggg== In-Reply-To: (Lars Ingebrigtsen's message of "Sat, 15 Jun 2019 14:46:09 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.231.51 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:237683 Archived-At: 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