unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lektu@terra.es>
Subject: Is CHAR_TO_BYTE considered to have no side-effects?
Date: Wed, 17 Apr 2002 16:30:19 +0200	[thread overview]
Message-ID: <20020417162147.20D9.LEKTU@terra.es> (raw)

The following patch removes two unused local variables from
current_column_1 and Fmove_to_column, but is is conditional on supposing
CHAR_TO_BYTE has no side effects.

In fact it can have, has CHAR_TO_BYTE hides a call to
buf_charpos_to_bytepos, which in turn can potentially make things like
creating (short-lived) markers for caching, etc.

So, can CHAR_TO_BYTE be considered, interface-wise, as side-effect free?


                                                           /L/e/k/t/u




Index: indent.c
===================================================================
RCS file: /cvs/emacs/src/indent.c,v
retrieving revision 1.148
diff -u -r1.148 indent.c
--- indent.c	17 Apr 2002 14:19:00 -0000	1.148
+++ indent.c	17 Apr 2002 14:20:46 -0000
@@ -512,7 +512,7 @@
   /* Start the scan at the beginning of this line with column number 0.  */
   register int col = 0;
   int scan, scan_byte;
-  int next_boundary, next_boundary_byte;
+  int next_boundary;
   int opoint = PT, opoint_byte = PT_BYTE;
 
   scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);
@@ -520,7 +520,6 @@
   scan = PT, scan_byte = PT_BYTE;
   SET_PT_BOTH (opoint, opoint_byte);
   next_boundary = scan;
-  next_boundary_byte = scan_byte;
 
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
 
@@ -540,7 +539,6 @@
 	    goto endloop;
 	  if (scan != old_scan)
 	    scan_byte = CHAR_TO_BYTE (scan);
-	  next_boundary_byte = CHAR_TO_BYTE (next_boundary);
 	}
 
       /* Check composition sequence.  */
@@ -937,8 +935,7 @@
   int prev_col = 0;
   int c = 0;
   int next_boundary;
-
-  int pos_byte, next_boundary_byte;
+  int pos_byte;
 
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
   CHECK_NATNUM (column);
@@ -948,7 +945,6 @@
   pos_byte = PT_BYTE;
   end = ZV;
   next_boundary = pos;
-  next_boundary_byte = PT_BYTE;
 
   /* If we're starting past the desired column,
      back up to beginning of line and scan from there.  */
@@ -968,7 +964,6 @@
 	  pos = skip_invisible (pos, &next_boundary, end, Qnil);
 	  if (pos != prev)
 	    pos_byte = CHAR_TO_BYTE (pos);
-	  next_boundary_byte = CHAR_TO_BYTE (next_boundary);
 	  if (pos >= end)
 	    goto endloop;
 	}

             reply	other threads:[~2002-04-17 14:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-17 14:30 Juanma Barranquero [this message]
2002-04-18 18:44 ` Is CHAR_TO_BYTE considered to have no side-effects? Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20020417162147.20D9.LEKTU@terra.es \
    --to=lektu@terra.es \
    /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 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).