emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src ChangeLog character.h emacs.c font.c ...


From: Dan Nicolaescu
Subject: [Emacs-diffs] emacs/src ChangeLog character.h emacs.c font.c ...
Date: Fri, 06 Nov 2009 06:07:49 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   09/11/06 06:07:49

Modified files:
        src            : ChangeLog character.h emacs.c font.c lisp.h 
                         lread.c process.c 

Log message:
        * process.c (socket_options): Make it const.
        (set_socket_option, init_process): Use a const pointer.
        
        * lread.c (intern_c_string): New function.
        (defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
        (defvar_int): Uset it.  Make the name const char*.
        
        * lisp.h (defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
        (defvar_int): Update prototypes.
        (DEFUN, EXFUN): Support for prototypes is now required.
        (intern_c_string): New prototype.
        (struct Lisp_Subr): Make symbol_name constant.
        
        * font.c (struct table_entry): Remove unused member.  Make NAMES
        constant.
        (weight_table, slant_table, width_table): Make constant.
        
        * emacs.c (struct standard_args): Make name and longname constant.
        
        * character.h (DEFSYM): Use intern_c_string.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7838&r2=1.7839
http://cvs.savannah.gnu.org/viewcvs/emacs/src/character.h?cvsroot=emacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/emacs/src/emacs.c?cvsroot=emacs&r1=1.473&r2=1.474
http://cvs.savannah.gnu.org/viewcvs/emacs/src/font.c?cvsroot=emacs&r1=1.140&r2=1.141
http://cvs.savannah.gnu.org/viewcvs/emacs/src/lisp.h?cvsroot=emacs&r1=1.672&r2=1.673
http://cvs.savannah.gnu.org/viewcvs/emacs/src/lread.c?cvsroot=emacs&r1=1.415&r2=1.416
http://cvs.savannah.gnu.org/viewcvs/emacs/src/process.c?cvsroot=emacs&r1=1.599&r2=1.600

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7838
retrieving revision 1.7839
diff -u -b -r1.7838 -r1.7839
--- ChangeLog   6 Nov 2009 05:24:28 -0000       1.7838
+++ ChangeLog   6 Nov 2009 06:07:46 -0000       1.7839
@@ -1,3 +1,26 @@
+2009-11-06  Dan Nicolaescu  <address@hidden>
+
+       * process.c (socket_options): Make it const.
+       (set_socket_option, init_process): Use a const pointer.
+
+       * lread.c (intern_c_string): New function.
+       (defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
+       (defvar_int): Uset it.  Make the name const char*.
+
+       * lisp.h (defvar_kboard, defvar_lisp, defvar_lisp_nopro, defvar_bool)
+       (defvar_int): Update prototypes.
+       (DEFUN, EXFUN): Support for prototypes is now required.
+       (intern_c_string): New prototype.
+       (struct Lisp_Subr): Make symbol_name constant.
+
+       * font.c (struct table_entry): Remove unused member.  Make NAMES
+       constant.
+       (weight_table, slant_table, width_table): Make constant.
+
+       * emacs.c (struct standard_args): Make name and longname constant.
+
+       * character.h (DEFSYM): Use intern_c_string.
+
 2009-11-06  Stefan Monnier  <address@hidden>
 
        * alloc.c (make_pure_c_string): New function.

Index: character.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/character.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- character.h 18 Oct 2009 03:08:34 -0000      1.17
+++ character.h 6 Nov 2009 06:07:48 -0000       1.18
@@ -672,7 +672,7 @@
   } while (0)
 
 #define DEFSYM(sym, name)      \
-  do { (sym) = intern ((name)); staticpro (&(sym)); } while (0)
+  do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
 
 #endif /* EMACS_CHARACTER_H */
 

Index: emacs.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/emacs.c,v
retrieving revision 1.473
retrieving revision 1.474
diff -u -b -r1.473 -r1.474
--- emacs.c     23 Oct 2009 17:33:55 -0000      1.473
+++ emacs.c     6 Nov 2009 06:07:48 -0000       1.474
@@ -1836,13 +1836,13 @@
 
 struct standard_args
 {
-  char *name;
-  char *longname;
+  const char *name;
+  const char *longname;
   int priority;
   int nargs;
 };
 
-struct standard_args standard_args[] =
+const struct standard_args standard_args[] =
 {
   { "-version", "--version", 150, 0 },
 #ifdef HAVE_SHM

Index: font.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/font.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -b -r1.140 -r1.141
--- font.c      19 Oct 2009 04:27:15 -0000      1.140
+++ font.c      6 Nov 2009 06:07:48 -0000       1.141
@@ -79,14 +79,13 @@
   int numeric;
   /* The first one is a valid name as a face attribute.
      The second one (if any) is a typical name in XLFD field.  */
-  char *names[5];
-  Lisp_Object *symbols;
+  const char *names[5];
 };
 
 /* Table of weight numeric values and their names.  This table must be
    sorted by numeric values in ascending order.  */
 
-static struct table_entry weight_table[] =
+static const struct table_entry weight_table[] =
 {
   { 0, { "thin" }},
   { 20, { "ultra-light", "ultralight" }},
@@ -103,7 +102,7 @@
 /* Table of slant numeric values and their names.  This table must be
    sorted by numeric values in ascending order.  */
 
-static struct table_entry slant_table[] =
+static const struct table_entry slant_table[] =
 {
   { 0, { "reverse-oblique", "ro" }},
   { 10, { "reverse-italic", "ri" }},
@@ -115,7 +114,7 @@
 /* Table of width numeric values and their names.  This table must be
    sorted by numeric values in ascending order.  */
 
-static struct table_entry width_table[] =
+static const struct table_entry width_table[] =
 {
   { 50, { "ultra-condensed", "ultracondensed" }},
   { 63, { "extra-condensed", "extracondensed" }},

Index: lisp.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/lisp.h,v
retrieving revision 1.672
retrieving revision 1.673
diff -u -b -r1.672 -r1.673
--- lisp.h      3 Nov 2009 21:12:15 -0000       1.672
+++ lisp.h      6 Nov 2009 06:07:48 -0000       1.673
@@ -922,7 +922,7 @@
     EMACS_UINT size;
     Lisp_Object (*function) ();
     short min_args, max_args;
-    char *symbol_name;
+    const char *symbol_name;
     char *intspec;
     char *doc;
   };
@@ -1701,17 +1701,6 @@
     A null string means call interactively with no arguments.
  `doc' is documentation for the user.  */
 
-#if (!defined (__STDC__) && !defined (PROTOTYPES))
-
-#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc)    \
-  Lisp_Object fnname ();                                               \
-  DECL_ALIGN (struct Lisp_Subr, sname) =                               \
-    { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),    \
-      fnname, minargs, maxargs, lname, intspec, 0};                    \
-  Lisp_Object fnname
-
-#else
-
 /* This version of DEFUN declares a function prototype with the right
    arguments, so we can catch errors with maxargs at compile-time.  */
 #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc)    \
@@ -1738,8 +1727,6 @@
                         Lisp_Object, Lisp_Object, Lisp_Object)
 #define DEFUN_ARGS_8   (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \
                         Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
-#endif
-
 /* Non-zero if OBJ is a Lisp function.  */
 
 #define FUNCTIONP(OBJ)                                 \
@@ -1755,11 +1742,11 @@
 #define MANY -2
 #define UNEVALLED -1
 
-extern void defvar_lisp P_ ((char *, Lisp_Object *));
-extern void defvar_lisp_nopro P_ ((char *, Lisp_Object *));
-extern void defvar_bool P_ ((char *, int *));
-extern void defvar_int P_ ((char *, EMACS_INT *));
-extern void defvar_kboard P_ ((char *, int));
+extern void defvar_lisp (const char *, Lisp_Object *);
+extern void defvar_lisp_nopro (const char *, Lisp_Object *);
+extern void defvar_bool (const char *, int *);
+extern void defvar_int (const char *, EMACS_INT *);
+extern void defvar_kboard (const char *, int);
 
 /* Macros we use to define forwarded Lisp variables.
    These are used in the syms_of_FILENAME functions.  */
@@ -2185,15 +2172,10 @@
 
 /* Declare a Lisp-callable function.  The MAXARGS parameter has the same
    meaning as in the DEFUN macro, and is used to construct a prototype.  */
-#if (!defined (__STDC__) &&  !defined (PROTOTYPES))
-#define EXFUN(fnname, maxargs) \
-  extern Lisp_Object fnname ()
-#else
 /* We can use the same trick as in the DEFUN macro to generate the
    appropriate prototype.  */
 #define EXFUN(fnname, maxargs) \
   extern Lisp_Object fnname DEFUN_ARGS_ ## maxargs
-#endif
 
 /* Forward declarations for prototypes.  */
 struct window;
@@ -2654,6 +2636,7 @@
 extern Lisp_Object make_specified_string P_ ((const char *, int, int, int));
 EXFUN (Fpurecopy, 1);
 extern Lisp_Object make_pure_string P_ ((char *, int, int, int));
+extern Lisp_Object make_pure_c_string (const char *data);
 extern Lisp_Object pure_cons P_ ((Lisp_Object, Lisp_Object));
 extern Lisp_Object make_pure_vector P_ ((EMACS_INT));
 EXFUN (Fgarbage_collect, 0);
@@ -2752,6 +2735,7 @@
 EXFUN (Feval_region, 4);
 extern Lisp_Object check_obarray P_ ((Lisp_Object));
 extern Lisp_Object intern P_ ((const char *));
+extern Lisp_Object intern_c_string (const char *);
 extern Lisp_Object make_symbol P_ ((char *));
 extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
 #define LOADHIST_ATTACH(x) \

Index: lread.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/lread.c,v
retrieving revision 1.415
retrieving revision 1.416
diff -u -b -r1.415 -r1.416
--- lread.c     30 Oct 2009 02:00:39 -0000      1.415
+++ lread.c     6 Nov 2009 06:07:48 -0000       1.416
@@ -3622,6 +3622,29 @@
   return Fintern (make_string (str, len), obarray);
 }
 
+Lisp_Object
+intern_c_string (const char *str)
+{
+  Lisp_Object tem;
+  int len = strlen (str);
+  Lisp_Object obarray;
+
+  obarray = Vobarray;
+  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+    obarray = check_obarray (obarray);
+  tem = oblookup (obarray, str, len, len);
+  if (SYMBOLP (tem))
+    return tem;
+
+  if (NILP (Vpurify_flag))
+    /* Creating a non-pure string from a string literal not
+       implemented yet.  We could just use make_string here and live
+       with the extra copy.  */
+    abort ();
+
+  return Fintern (make_pure_c_string (str), obarray);
+}
+
 /* Create an uninterned symbol with name STR.  */
 
 Lisp_Object
@@ -3956,12 +3979,10 @@
    to a C variable of type int.  Sample call:
    DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation");  */
 void
-defvar_int (namestring, address)
-     char *namestring;
-     EMACS_INT *address;
+defvar_int (const char *namestring, EMACS_INT *address)
 {
   Lisp_Object sym, val;
-  sym = intern (namestring);
+  sym = intern_c_string (namestring);
   val = allocate_misc ();
   XMISCTYPE (val) = Lisp_Misc_Intfwd;
   XINTFWD (val)->intvar = address;
@@ -3971,12 +3992,10 @@
 /* Similar but define a variable whose value is t if address contains 1,
    nil if address contains 0.  */
 void
-defvar_bool (namestring, address)
-     char *namestring;
-     int *address;
+defvar_bool (const char *namestring, int *address)
 {
   Lisp_Object sym, val;
-  sym = intern (namestring);
+  sym = intern_c_string (namestring);
   val = allocate_misc ();
   XMISCTYPE (val) = Lisp_Misc_Boolfwd;
   XBOOLFWD (val)->boolvar = address;
@@ -3990,12 +4009,10 @@
    gc-marked for some other reason, since marking the same slot twice
    can cause trouble with strings.  */
 void
-defvar_lisp_nopro (namestring, address)
-     char *namestring;
-     Lisp_Object *address;
+defvar_lisp_nopro (const char *namestring, Lisp_Object *address)
 {
   Lisp_Object sym, val;
-  sym = intern (namestring);
+  sym = intern_c_string (namestring);
   val = allocate_misc ();
   XMISCTYPE (val) = Lisp_Misc_Objfwd;
   XOBJFWD (val)->objvar = address;
@@ -4003,9 +4020,7 @@
 }
 
 void
-defvar_lisp (namestring, address)
-     char *namestring;
-     Lisp_Object *address;
+defvar_lisp (const char *namestring, Lisp_Object *address)
 {
   defvar_lisp_nopro (namestring, address);
   staticpro (address);
@@ -4015,12 +4030,10 @@
    at a particular offset in the current kboard object.  */
 
 void
-defvar_kboard (namestring, offset)
-     char *namestring;
-     int offset;
+defvar_kboard (const char *namestring, int offset)
 {
   Lisp_Object sym, val;
-  sym = intern (namestring);
+  sym = intern_c_string (namestring);
   val = allocate_misc ();
   XMISCTYPE (val) = Lisp_Misc_Kboard_Objfwd;
   XKBOARD_OBJFWD (val)->offset = offset;

Index: process.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/process.c,v
retrieving revision 1.599
retrieving revision 1.600
diff -u -b -r1.599 -r1.600
--- process.c   19 Oct 2009 05:13:32 -0000      1.599
+++ process.c   6 Nov 2009 06:07:48 -0000       1.600
@@ -2607,7 +2607,7 @@
 #endif
 
 
-static struct socket_options {
+static const struct socket_options {
   /* The name of this option.  Should be lowercase version of option
      name without SO_ prefix. */
   char *name;
@@ -2658,7 +2658,7 @@
      Lisp_Object opt, val;
 {
   char *name;
-  struct socket_options *sopt;
+  const struct socket_options *sopt;
   int ret = 0;
 
   CHECK_SYMBOL (opt);
@@ -7314,7 +7314,7 @@
 #ifdef HAVE_SOCKETS
  {
    Lisp_Object subfeatures = Qnil;
-   struct socket_options *sopt;
+   const struct socket_options *sopt;
 
 #define ADD_SUBFEATURE(key, val) \
   subfeatures = Fcons (Fcons (key, Fcons (val, Qnil)), subfeatures)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]