all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: qiang <qguo@ualberta.ca>
To: emacs-devel@gnu.org
Subject: String allocation
Date: Sat, 12 Nov 2011 23:01:50 -0700	[thread overview]
Message-ID: <87mxc0blwx.fsf@ualberta.ca> (raw)


Thanks to all of you. Reading source code is such an experience for
me, both painful and yet enjoyable. 

Since we are talking about strings, can I ask another obstacle I met. I
know when allocating string objects, emacs will retrieve one from a
string_block struct. My question is how this string_free_list works ?
where does it point to ? How it becomes a list ? Especially I'm puzzled
by this macro

#define NEXT_FREE_LISP_STRING(S) (*(struct Lisp_String **) (S))

I understand S is a pointer to a Lisp_String, how can the following code
construct a free_list ?

for (i = STRING_BLOCK_SIZE - 1; i >= 0; --i)
	{
	  s = b->strings + i;
	  NEXT_FREE_LISP_STRING (s) = string_free_list;
	  string_free_list = s;
	}

Regards
Qiang




             reply	other threads:[~2011-11-13  6:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13  6:01 qiang [this message]
2011-11-13  6:42 ` String allocation Eli Zaretskii
2011-11-13  7:05   ` Qiang Guo
2011-11-13  7:57     ` Eli Zaretskii
2011-11-13  8:32       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxc0blwx.fsf@ualberta.ca \
    --to=qguo@ualberta.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.