From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: static declaration inside `window_scroll_pixel_based' in window.c Date: Wed, 8 Mar 2006 18:27:26 -0600 (CST) Message-ID: <200603090027.k290RQJ23085@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1142017557 15359 80.91.229.2 (10 Mar 2006 19:05:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 10 Mar 2006 19:05:57 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 10 20:05:54 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FHmvi-0008Lx-Bl for ged-emacs-devel@m.gmane.org; Fri, 10 Mar 2006 20:05:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHmvh-00032k-Pw for ged-emacs-devel@m.gmane.org; Fri, 10 Mar 2006 14:05:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FH958-0003P5-6S for emacs-devel@gnu.org; Wed, 08 Mar 2006 19:32:42 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FH952-0002kP-3V for emacs-devel@gnu.org; Wed, 08 Mar 2006 19:32:40 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FH951-0002jx-3L for emacs-devel@gnu.org; Wed, 08 Mar 2006 19:32:35 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FH97x-0007M6-UJ for emacs-devel@gnu.org; Wed, 08 Mar 2006 19:35:38 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.13.3+Sun/8.13.3) with ESMTP id k290WS3c004624 for ; Wed, 8 Mar 2006 18:32:28 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id k290RQJ23085; Wed, 8 Mar 2006 18:27:26 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.1 (manatee.dms.auburn.edu [131.204.53.104]); Wed, 08 Mar 2006 18:32:29 -0600 (CST) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51434 Archived-At: `(elisp)Writing Emacs Primitives' contains: You must not use C initializers for static or global variables unless the variables are never written once Emacs is dumped. These variables with initializers are allocated in an area of memory that becomes read-only (on certain operating systems) as a result of dumping Emacs. *Note Pure Storage::. Do not use static variables within functions--place all static variables at top level in the file. This is necessary because Emacs on some operating systems defines the keyword `static' as a null macro. (This definition is used because those systems put all variables declared static in a place that becomes read-only after dumping, whether they have initializers or not.) but preserve_y is declared a static int and initialized to -1 in the function `window_scroll_pixel_based' on line 4727 of window.c. I know there are exceptions to the above quoted rules. If you are sure that your code is not going to be used on one of the affected OS's, there is no problem. _Maybe_ that applies here, but I am not sure. Does it? At first view I would say no, but I have no idea what the problematic OS's are. Anyway, if the above quote from `(elisp)Writing Emacs Primitives' does apply here, the problem would be easy to fix with the following patch, which I can install if desired. ===File ~/window.c-diff===================================== *** window.c 28 Feb 2006 10:26:44 -0600 1.537 --- window.c 08 Mar 2006 17:40:13 -0600 *************** *** 215,220 **** --- 215,224 ---- int window_deletion_count; + /* Used by the function window_scroll_pixel_based */ + + static int preserve_y; + #if 0 /* This isn't used anywhere. */ /* Nonzero means we can split a frame even if it is "unsplittable". */ static int inhibit_frame_unsplittable; *************** *** 4724,4730 **** int this_scroll_margin; /* True if we fiddled the window vscroll field without really scrolling. */ int vscrolled = 0; ! static int preserve_y = -1; SET_TEXT_POS_FROM_MARKER (start, w->start); --- 4728,4735 ---- int this_scroll_margin; /* True if we fiddled the window vscroll field without really scrolling. */ int vscrolled = 0; ! ! preserve_y = -1; SET_TEXT_POS_FROM_MARKER (start, w->start); ============================================================