Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit make constant arrays a const



details:   https://anonhg.NetBSD.org/src/rev/be2d08aafa74
branches:  trunk
changeset: 501941:be2d08aafa74
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Jan 09 17:22:09 2001 +0000

description:
make constant arrays a const

diffstat:

 lib/libedit/map.c  |  16 ++++++++--------
 lib/libedit/map.h  |   8 ++++----
 lib/libedit/term.c |  37 +++++++++++++++++++------------------
 3 files changed, 31 insertions(+), 30 deletions(-)

diffs (208 lines):

diff -r c14c8e415835 -r be2d08aafa74 lib/libedit/map.c
--- a/lib/libedit/map.c Tue Jan 09 17:08:47 2001 +0000
+++ b/lib/libedit/map.c Tue Jan 09 17:22:09 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: map.c,v 1.13 2001/01/04 15:56:32 christos Exp $        */
+/*     $NetBSD: map.c,v 1.14 2001/01/09 17:22:09 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)map.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: map.c,v 1.13 2001/01/04 15:56:32 christos Exp $");
+__RCSID("$NetBSD: map.c,v 1.14 2001/01/09 17:22:09 jdolecek Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -63,7 +63,7 @@
 /* keymap tables ; should be N_KEYS*sizeof(KEYCMD) bytes long */
 
 
-private el_action_t  el_map_emacs[] = {
+private const el_action_t  el_map_emacs[] = {
        /*   0 */       EM_SET_MARK,            /* ^@ */
        /*   1 */       ED_MOVE_TO_BEG,         /* ^A */
        /*   2 */       ED_PREV_CHAR,           /* ^B */
@@ -330,7 +330,7 @@
  * insert mode characters are in the normal keymap, and command mode
  * in the extended keymap.
  */
-private el_action_t  el_map_vi_insert[] = {
+private const el_action_t  el_map_vi_insert[] = {
 #ifdef KSHVI
        /*   0 */       ED_UNASSIGNED,          /* ^@ */
        /*   1 */       ED_INSERT,              /* ^A */
@@ -631,7 +631,7 @@
        /* 255 */       ED_UNASSIGNED           /* M-^? */
 };
 
-private el_action_t el_map_vi_command[] = {
+private const el_action_t el_map_vi_command[] = {
        /*   0 */       ED_UNASSIGNED,          /* ^@ */
        /*   1 */       ED_MOVE_TO_BEG,         /* ^A */
        /*   2 */       ED_UNASSIGNED,          /* ^B */
@@ -1028,8 +1028,8 @@
        int i;
        el_action_t *key = el->el_map.key;
        el_action_t *alt = el->el_map.alt;
-       el_action_t *vii = el->el_map.vii;
-       el_action_t *vic = el->el_map.vic;
+       const el_action_t *vii = el->el_map.vii;
+       const el_action_t *vic = el->el_map.vic;
 
        el->el_map.type = MAP_VI;
        el->el_map.current = el->el_map.key;
@@ -1059,7 +1059,7 @@
        char buf[3];
        el_action_t *key = el->el_map.key;
        el_action_t *alt = el->el_map.alt;
-       el_action_t *emacs = el->el_map.emacs;
+       const el_action_t *emacs = el->el_map.emacs;
 
        el->el_map.type = MAP_EMACS;
        el->el_map.current = el->el_map.key;
diff -r c14c8e415835 -r be2d08aafa74 lib/libedit/map.h
--- a/lib/libedit/map.h Tue Jan 09 17:08:47 2001 +0000
+++ b/lib/libedit/map.h Tue Jan 09 17:22:09 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: map.h,v 1.5 2000/09/04 22:06:31 lukem Exp $    */
+/*     $NetBSD: map.h,v 1.6 2001/01/09 17:22:09 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -55,9 +55,9 @@
        el_action_t     *alt;           /* The current alternate key map */
        el_action_t     *key;           /* The current normal key map   */
        el_action_t     *current;       /* The keymap we are using      */
-       el_action_t     *emacs;         /* The default emacs key map    */
-       el_action_t     *vic;           /* The vi command mode key map  */
-       el_action_t     *vii;           /* The vi insert mode key map   */
+       const el_action_t *emacs;       /* The default emacs key map    */
+       const el_action_t *vic;         /* The vi command mode key map  */
+       const el_action_t *vii;         /* The vi insert mode key map   */
        int              type;          /* Emacs or vi                  */
        el_bindings_t   *help;          /* The help for the editor functions */
        el_func_t       *func;          /* List of available functions  */
diff -r c14c8e415835 -r be2d08aafa74 lib/libedit/term.c
--- a/lib/libedit/term.c        Tue Jan 09 17:08:47 2001 +0000
+++ b/lib/libedit/term.c        Tue Jan 09 17:22:09 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: term.c,v 1.28 2001/01/04 15:56:32 christos Exp $       */
+/*     $NetBSD: term.c,v 1.29 2001/01/09 17:22:09 jdolecek Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)term.c     8.2 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: term.c,v 1.28 2001/01/04 15:56:32 christos Exp $");
+__RCSID("$NetBSD: term.c,v 1.29 2001/01/09 17:22:09 jdolecek Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -77,8 +77,8 @@
 #define        Val(a)          el->el_term.t_val[a]
 
 #ifdef notdef
-private struct {
-       char *b_name;
+private const struct {
+       const char *b_name;
        int b_rate;
 } baud_rate[] = {
 #ifdef B0
@@ -148,9 +148,9 @@
 };
 #endif
 
-private struct termcapstr {
-       char *name;
-       char *long_name;
+private const struct termcapstr {
+       const char *name;
+       const char *long_name;
 } tstr[] = {
 #define        T_al    0
        { "al", "add new blank line" },
@@ -232,9 +232,9 @@
        { NULL, NULL }
 };
 
-private struct termcapval {
-       char *name;
-       char *long_name;
+private const struct termcapval {
+       const char *name;
+       const char *long_name;
 } tval[] = {
 #define        T_am    0
        { "am", "has automatic margins" },
@@ -261,7 +261,7 @@
 private int    term_rebuffer_display(EditLine *);
 private void   term_free_display(EditLine *);
 private int    term_alloc_display(EditLine *);
-private void   term_alloc(EditLine *, struct termcapstr *, char *);
+private void   term_alloc(EditLine *, const struct termcapstr *, char *);
 private void   term_init_arrow(EditLine *);
 private void   term_reset_arrow(EditLine *);
 
@@ -370,7 +370,7 @@
  *     Maintain a string pool for termcap strings
  */
 private void
-term_alloc(EditLine *el, struct termcapstr *t, char *cap)
+term_alloc(EditLine *el, const struct termcapstr *t, char *cap)
 {
        char termbuf[TC_BUFSIZE];
        int tlen, clen;
@@ -883,7 +883,7 @@
        int i;
        char buf[TC_BUFSIZE];
        char *area;
-       struct termcapstr *t;
+       const struct termcapstr *t;
        sigset_t oset, nset;
        int lins, cols;
 
@@ -1165,7 +1165,8 @@
 protected void
 term_bind_arrow(EditLine *el)
 {
-       el_action_t *map, *dmap;
+       el_action_t *map;
+       const el_action_t *dmap;
        int i, j;
        char *p;
        fkey_t *arrow = el->el_term.t_fkey;
@@ -1244,7 +1245,7 @@
 /*ARGSUSED*/
 term_telltc(EditLine *el, int argc, char **argv)
 {
-       struct termcapstr *t;
+       const struct termcapstr *t;
        char **ts;
        char upbuf[EL_BUFSIZ];
 
@@ -1279,8 +1280,8 @@
 /*ARGSUSED*/
 term_settc(EditLine *el, int argc, char **argv)
 {
-       struct termcapstr *ts;
-       struct termcapval *tv;
+       const struct termcapstr *ts;
+       const struct termcapval *tv;
        char *what, *how;
 
        if (argv == NULL || argv[1] == NULL || argv[2] == NULL)
@@ -1360,7 +1361,7 @@
        int verbose = 0, silent = 0;
        char *area;
        static const char fmts[] = "%s\n", fmtd[] = "%d\n";
-       struct termcapstr *t;
+       const struct termcapstr *t;
        char buf[TC_BUFSIZE];
        long i;
 



Home | Main Index | Thread Index | Old Index