unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: trunk r113953: * image.c: Shrink memory needed for animation cache.
       [not found] <E1VBWMN-0000q0-1s@vcs.savannah.gnu.org>
@ 2013-08-19 23:19 ` Lars Magne Ingebrigtsen
  2013-08-20  0:53   ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-19 23:19 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

Paul Eggert <eggert@cs.ucla.edu> writes:

> +/* Size of ImageMagick image signatures, in bytes.  It's SHA-256 as a
> +   hex string, so it's 256 bits represented via 4 bits per byte.  */
> +enum { SIGNATURE_DIGESTSIZE = 256 / 4 };

Do we really need to know this?  It's a zero-terminated string (in a
larger block), so just by calling strdup, we're OK, and we don't need
any magical constants.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
  and http://lars.ingebrigtsen.no/2013/08/twenty-years-of-september.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: trunk r113953: * image.c: Shrink memory needed for animation cache.
  2013-08-19 23:19 ` trunk r113953: * image.c: Shrink memory needed for animation cache Lars Magne Ingebrigtsen
@ 2013-08-20  0:53   ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2013-08-20  0:53 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: emacs-devel

Lars Magne Ingebrigtsen wrote:
> Do we really need to know this?  It's a zero-terminated string (in a
> larger block), so just by calling strdup, we're OK, and we don't need
> any magical constants.

Calling strdup would mean we'd be calling malloc twice
instead of once.  Insted, we can make the signature a flexible
array member.  This is a bit slower than what we had, but it's
better than calling malloc twice and it would insulate us better
if ImageMagick switches to a different digest format.
I did that in trunk bzr 113954.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-20  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1VBWMN-0000q0-1s@vcs.savannah.gnu.org>
2013-08-19 23:19 ` trunk r113953: * image.c: Shrink memory needed for animation cache Lars Magne Ingebrigtsen
2013-08-20  0:53   ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).