all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Johannes Weiner <hannes@saeurebad.de>
To: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Please install and ack
Date: Wed, 12 Sep 2007 12:08:11 +0200	[thread overview]
Message-ID: <20070912100811.GC12104@saeurebad.de> (raw)
In-Reply-To: <E1IVCOl-0000qc-F6@fencepost.gnu.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 876 bytes --]

Hi,

On Tue, Sep 11, 2007 at 04:31:51PM -0400, Richard Stallman wrote:
> --- src/xterm.c.orig	2007-05-25 12:43:35.000000000 +0000
> +++ src/xterm.c	2007-08-31 03:43:32.106444418 +0000
>  
> +#ifndef abs
>  #define abs(x)	((x) < 0 ? -(x) : (x))
> +#endif
>  
> --- src/keyboard.c.orig	2007-04-01 21:54:54.000000000 +0000
> +++ src/keyboard.c	2007-08-31 03:43:32.291971223 +0000
>  
> +#ifndef abs
>  #define abs(x)		((x) >= 0 ? (x) : -(x))
> +#endif
>  
> --- src/xfaces.c.orig	2007-02-14 15:47:51.000000000 +0000
> +++ src/xfaces.c	2007-09-06 18:17:56.728517424 +0000
>
> -
> +#ifndef abs
>  #define abs(X)		((X) < 0 ? -(X) : (X))
> -
> +#endif

Wouldn't it be better to centralize that macro?  It's trivial, sure.  But
repetition is not beautiful.  I have a patch attached, but I'm not quite sure
if config.h is the place to do this..

	Hannes

[-- Attachment #1.1.2: emacs-centralize-abs-definition.patch --]
[-- Type: text/x-diff, Size: 3340 bytes --]

Index: configure.in
===================================================================
RCS file: /sources/emacs/emacs/configure.in,v
retrieving revision 1.474
diff -u -r1.474 configure.in
--- configure.in	12 Sep 2007 07:03:30 -0000	1.474
+++ configure.in	12 Sep 2007 09:58:33 -0000
@@ -2729,7 +2729,7 @@
 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
 random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \
-strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
+strerror fpathconf select mktime euidaccess getpagesize tzset setlocale abs \
 utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
 sendto recvfrom getsockopt setsockopt getsockname getpeername \
@@ -3375,6 +3375,10 @@
 #define BCMP memcmp
 #endif
 
+#ifndef HAVE_ABS
+#define abs(x) ((x) < 0 ? -(x) : (x))
+#endif
+
 #endif /* EMACS_CONFIG_H */
 
 /*
Index: src/keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.913
diff -u -r1.913 keyboard.c
--- src/keyboard.c	12 Sep 2007 07:19:55 -0000	1.913
+++ src/keyboard.c	12 Sep 2007 09:58:47 -0000
@@ -108,8 +108,6 @@
 #define KBD_BUFFER_SIZE 4096
 #endif	/* No X-windows */
 
-#define abs(x)		((x) >= 0 ? (x) : -(x))
-
 /* Following definition copied from eval.c */
 
 struct backtrace
Index: src/sound.c
===================================================================
RCS file: /sources/emacs/emacs/src/sound.c,v
retrieving revision 1.45
diff -u -r1.45 sound.c
--- src/sound.c	26 Jul 2007 05:27:56 -0000	1.45
+++ src/sound.c	12 Sep 2007 09:58:48 -0000
@@ -96,9 +96,6 @@
 
 #endif /* WINDOWSNT */
 
-/* BEGIN: Common Definitions */
-#define abs(X)    ((X) < 0 ? -(X) : (X))
-
 /* Symbols.  */
 
 extern Lisp_Object QCfile, QCdata;
Index: src/w32term.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32term.c,v
retrieving revision 1.265
diff -u -r1.265 w32term.c
--- src/w32term.c	4 Sep 2007 21:38:40 -0000	1.265
+++ src/w32term.c	12 Sep 2007 09:58:48 -0000
@@ -58,8 +58,6 @@
 #include "composite.h"
 #include "coding.h"
 
-#define abs(x)	((x) < 0 ? -(x) : (x))
-
 \f
 /* Fringe bitmaps.  */
 
Index: src/xfaces.c
===================================================================
RCS file: /sources/emacs/emacs/src/xfaces.c,v
retrieving revision 1.364
diff -u -r1.364 xfaces.c
--- src/xfaces.c	29 Aug 2007 21:46:05 -0000	1.364
+++ src/xfaces.c	12 Sep 2007 09:58:48 -0000
@@ -267,8 +267,6 @@
 
 #include <ctype.h>
 
-#define abs(X)		((X) < 0 ? -(X) : (X))
-
 /* Number of pt per inch (from the TeXbook).  */
 
 #define PT_PER_INCH 72.27
Index: src/xterm.c
===================================================================
RCS file: /sources/emacs/emacs/src/xterm.c,v
retrieving revision 1.956
diff -u -r1.956 xterm.c
--- src/xterm.c	10 Sep 2007 21:25:32 -0000	1.956
+++ src/xterm.c	12 Sep 2007 09:58:48 -0000
@@ -154,8 +154,6 @@
 #endif
 #endif
 
-#define abs(x)	((x) < 0 ? -(x) : (x))
-
 /* Default to using XIM if available.  */
 #ifdef USE_XIM
 int use_xim = 1;

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-09-12 10:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-11 20:31 Please install and ack Richard Stallman
2007-09-12 10:08 ` Johannes Weiner [this message]
2007-09-12 14:05   ` Stefan Monnier
2007-09-12 20:02     ` Johannes Weiner
2007-09-12 20:08       ` Johannes Weiner
2007-09-12 18:52   ` Richard Stallman
2007-10-03 13:35   ` Jason Rumney
2007-09-16  8:56 ` Jan Djärv

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=20070912100811.GC12104@saeurebad.de \
    --to=hannes@saeurebad.de \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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.