From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: qiang Newsgroups: gmane.emacs.devel Subject: String allocation Date: Sat, 12 Nov 2011 23:01:50 -0700 Message-ID: <87mxc0blwx.fsf@ualberta.ca> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1321164138 19731 80.91.229.12 (13 Nov 2011 06:02:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Nov 2011 06:02:18 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 13 07:02:15 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RPT8w-0005fh-DZ for ged-emacs-devel@m.gmane.org; Sun, 13 Nov 2011 07:02:14 +0100 Original-Received: from localhost ([::1]:47878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPT8v-0007Xq-Jn for ged-emacs-devel@m.gmane.org; Sun, 13 Nov 2011 01:02:13 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPT8s-0007Xb-9Y for emacs-devel@gnu.org; Sun, 13 Nov 2011 01:02:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPT8r-0000rY-Ae for emacs-devel@gnu.org; Sun, 13 Nov 2011 01:02:10 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:42710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPT8r-0000rM-3v for emacs-devel@gnu.org; Sun, 13 Nov 2011 01:02:09 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RPT8n-0005e1-CW for emacs-devel@gnu.org; Sun, 13 Nov 2011 07:02:05 +0100 Original-Received: from d173-181-69-148.abhsia.telus.net ([173.181.69.148]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Nov 2011 07:02:05 +0100 Original-Received: from qguo by d173-181-69-148.abhsia.telus.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Nov 2011 07:02:05 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 24 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: d173-181-69-148.abhsia.telus.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:nwIZHiPuC2JL/5NEQQDIctNr7HY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146022 Archived-At: 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