all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* config related patch (and how to start handling Debian patches)
@ 2003-02-07 23:06 Rob Browning
  2003-02-09 12:40 ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Browning @ 2003-02-07 23:06 UTC (permalink / raw)



I'm not sure how you'd like to handle patches from the Debian packages
(including the mailspool/movemail one Dave and Francesco are
interested in), but I've just finished breaking up the Debian changes
into separate patches.  Hopefully this will make it easier to deal
with them independently, and to keep track of ownership.  For anything
I wrote there should be no copyright issues since my paperwork is on
file, and I currently don't have an employer (anyone looking for help?
:>).

For now I'll start with a few miscellaneous, but config related bits,
but feel free to ask me to handle these some other way, to rewrite
them, etc.  Time permitting, I'm happy to oblige.

With respect to the bzero change below, I didn't write that one, and
it predates my ownership of the Emacs packages, but I believe it's
short enough that it may not fall under the assignment requirements.
With respect to the HAVE_STDLIB_H changes, those will only be
appropriate for universal inclusion if stdlib.h is guaranteed to have
malloc and realloc.  I'm not positive about that on non GNU/Linux
platforms.


"NEWS" entries for changes:

** Emacs uses memset, memcmp, and mmove rather than deprecated functions.

File: 500-bzero-and-have-stdlib.diff
Status: sent-upstream, pending

#defines have been added to arrange for Emacs to use memset, memcmp,
and memmove instead of bzero, bcmp, and bcopy.

** HAVE_STDLIB_H checks have been added in various places.

File: 500-bzero-and-have-stdlib.diff
Author: rlb
Status: sent-upstream, pending

Primarily in lib-src.


And the patch (also appears to apply against 21.2.95 cleanly):

--- emacs21-21.2.orig/src/config.in
+++ emacs21-21.2/src/config.in
@@ -531,6 +538,10 @@
 #endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+/* Don't use deprecated functions.  */
+#define bzero(data, size) memset(data, '\0', size)
+#define bcmp memcmp
+#define bcopy(a,b,c) memmove(b,a,c)
 #endif
 #endif
 
--- emacs21-21.2.orig/lib-src/yow.c
+++ emacs21-21.2/lib-src/yow.c
@@ -10,6 +10,7 @@
  * With dynamic memory allocation.
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <ctype.h>
 #include <../src/epaths.h>      /* For PATH_DATA.  */
@@ -33,7 +34,9 @@
     &res;})
 #endif
 
+#ifndef HAVE_STDLIB_H		/* config.h includes stdlib.  */
 char *malloc(), *realloc();
+#endif
 
 void yow();
 void setup_yow();
--- emacs21-21.2.orig/lib-src/cvtmail.c
+++ emacs21-21.2/lib-src/cvtmail.c
@@ -33,11 +33,14 @@
  * Author: Larry Kolodney, 1985
  */
 
-
+#include "config.h"
 #include <stdio.h>
 
+#ifndef HAVE_STDLIB_H		/* config.h includes stdlib.  */
 char *malloc ();
 char *realloc ();
+#endif
+
 char *getenv ();
 
 char *xmalloc ();


-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: config related patch (and how to start handling Debian patches)
  2003-02-07 23:06 config related patch (and how to start handling Debian patches) Rob Browning
@ 2003-02-09 12:40 ` Richard Stallman
  2003-02-09 17:54   ` Rob Browning
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2003-02-09 12:40 UTC (permalink / raw)
  Cc: emacs-devel

It looks like you're working on year-old Emacs sources rather than
the latest ones.  This change is mostly obsolete.  Equivalent changes
were already made in lib-src.

We might want to define bzero etc. in config.h, but the change
would have to be changed differently now.

Could you adapt your changes to the current sources
from the Emacs repository?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: config related patch (and how to start handling Debian patches)
  2003-02-09 12:40 ` Richard Stallman
@ 2003-02-09 17:54   ` Rob Browning
  2003-02-10 22:38     ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Browning @ 2003-02-09 17:54 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> It looks like you're working on year-old Emacs sources rather than
> the latest ones.  This change is mostly obsolete.  Equivalent changes
> were already made in lib-src.

Hmm, sorry about that, I believe I tested the patch against the
current pretest, but maybe I'm mistaken.  Or are you saying you'd
prefer I work directly against current CVS?

> We might want to define bzero etc. in config.h, but the change
> would have to be changed differently now.

Alternately, I suppose all calls in the source could be changed to
memcpy, etc., but I'm not sure what your preference would be.

Thanks

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: config related patch (and how to start handling Debian patches)
  2003-02-09 17:54   ` Rob Browning
@ 2003-02-10 22:38     ` Richard Stallman
  2003-02-15  5:11       ` Rob Browning
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2003-02-10 22:38 UTC (permalink / raw)
  Cc: emacs-devel

    > It looks like you're working on year-old Emacs sources rather than
    > the latest ones.  This change is mostly obsolete.  Equivalent changes
    > were already made in lib-src.

    Hmm, sorry about that, I believe I tested the patch against the
    current pretest, but maybe I'm mistaken.  Or are you saying you'd
    prefer I work directly against current CVS?

The current pretest is from a branch that has only bug fixes.
The place we would install changes like these is in the CVS trunk,
so please make them fit in there.

    > We might want to define bzero etc. in config.h, but the change
    > would have to be changed differently now.

    Alternately, I suppose all calls in the source could be changed to
    memcpy, etc., but I'm not sure what your preference would be.

I'd rather change bzero in a configuration file, more or less as you
did it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: config related patch (and how to start handling Debian patches)
  2003-02-10 22:38     ` Richard Stallman
@ 2003-02-15  5:11       ` Rob Browning
  2003-02-15 18:01         ` Benjamin Riefenstahl
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Browning @ 2003-02-15  5:11 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> The current pretest is from a branch that has only bug fixes.
> The place we would install changes like these is in the CVS trunk,
> so please make them fit in there.

OK.  I've switched to cvs HEAD, and it looks like two of the three
patches are now redundant.

This small patch switches emacs to prefer the mem* functions rather
than the b* functions when they're available since at least under
GNU/Linux, the b* appear to be deprecated.  However, if this
deprecation isn't common, the following patch might not be the right
thing to do.

Index: configure.in
===================================================================
RCS file: /cvsroot/emacs/emacs/configure.in,v
retrieving revision 1.326
diff -u -r1.326 configure.in
--- configure.in	4 Feb 2003 14:56:31 -0000	1.326
+++ configure.in	15 Feb 2003 04:55:35 -0000
@@ -2206,7 +2206,8 @@
 utimes setrlimit setpgid getcwd getwd shutdown strftime getaddrinfo \
 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
 sendto recvfrom getsockopt setsockopt getsockname getpeername \
-gai_strerror mkstemp getline getdelim mremap memmove fsync bzero memset)
+gai_strerror mkstemp getline getdelim mremap memmove fsync bzero \
+memset memcmp memmove)
 
 AC_CHECK_HEADERS(sys/un.h)
 
@@ -2823,14 +2824,16 @@
 #  endif
 #endif
 
-#ifndef HAVE_BCOPY
-#define bcopy(a,b,s) memcpy (b,a,s)
-#endif
-#ifndef HAVE_BZERO
-#define bzero(a,s) memset (a,0,s)
-#endif
-#ifndef HAVE_BCMP
-#define BCMP memcmp
+/* avoid deprecated functions */
+#if HAVE_MEMCPY
+#  define bcopy(a,b,s) memcpy (b,a,s)
+#endif
+#if HAVE_MEMSET
+#  define bzero(a,s) memset (a,0,s)
+#endif
+#if HAVE_MEMCMP
+#  define BCMP memcmp
+#  define bcmp memcmp
 #endif
 
 #endif /* EMACS_CONFIG_H */

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: config related patch (and how to start handling Debian patches)
  2003-02-15  5:11       ` Rob Browning
@ 2003-02-15 18:01         ` Benjamin Riefenstahl
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Riefenstahl @ 2003-02-15 18:01 UTC (permalink / raw)
  Cc: emacs-devel

Hi Bob,

Rob Browning <rlb@defaultvalue.org> writes:
> This small patch switches emacs to prefer the mem* functions rather
> than the b* functions when they're available since at least under
> GNU/Linux, the b* appear to be deprecated.  However, if this
> deprecation isn't common, the following patch might not be the right
> thing to do.

bzero() etc are deprecated since the C language standard preferred
memset() etc instead in 1989, more than 13 years ago.  Not even the
POSIX standard has bzero() etc.  Just my personal impressions of
course ;-) ...

so long, benny

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-02-15 18:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-07 23:06 config related patch (and how to start handling Debian patches) Rob Browning
2003-02-09 12:40 ` Richard Stallman
2003-02-09 17:54   ` Rob Browning
2003-02-10 22:38     ` Richard Stallman
2003-02-15  5:11       ` Rob Browning
2003-02-15 18:01         ` Benjamin Riefenstahl

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.