[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/keymap.c
From: |
Kim F. Storm |
Subject: |
[Emacs-diffs] Changes to emacs/src/keymap.c |
Date: |
Fri, 10 May 2002 19:57:15 -0400 |
Index: emacs/src/keymap.c
diff -c emacs/src/keymap.c:1.259 emacs/src/keymap.c:1.260
*** emacs/src/keymap.c:1.259 Fri May 10 03:03:20 2002
--- emacs/src/keymap.c Fri May 10 19:57:14 2002
***************
*** 1248,1255 ****
/* We can't put these variables inside current_minor_maps, since under
some systems, static gets macro-defined to be the empty string.
Ickypoo. */
! static Lisp_Object *cmm_modes, *cmm_maps;
! static int cmm_size;
/* Error handler used in current_minor_maps. */
static Lisp_Object
--- 1248,1255 ----
/* We can't put these variables inside current_minor_maps, since under
some systems, static gets macro-defined to be the empty string.
Ickypoo. */
! static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL;
! static int cmm_size = 0;
/* Error handler used in current_minor_maps. */
static Lisp_Object
***************
*** 1321,1360 ****
if (i >= cmm_size)
{
Lisp_Object *newmodes, *newmaps;
! /* Use malloc/realloc here. See the comment above
! this function. */
! if (cmm_maps)
! {
! BLOCK_INPUT;
! cmm_size *= 2;
! newmodes
! = (Lisp_Object *) realloc (cmm_modes,
! cmm_size * sizeof *newmodes);
! newmaps
! = (Lisp_Object *) realloc (cmm_maps,
! cmm_size * sizeof *newmaps);
! UNBLOCK_INPUT;
! }
! else
{
! BLOCK_INPUT;
! cmm_size = 30;
! newmodes
! = (Lisp_Object *) malloc (cmm_size * sizeof *newmodes);
! newmaps
! = (Lisp_Object *) malloc (cmm_size * sizeof *newmaps);
! UNBLOCK_INPUT;
}
! if (newmodes)
! cmm_modes = newmodes;
if (newmaps)
! cmm_maps = newmaps;
if (newmodes == NULL || newmaps == NULL)
break;
}
/* Get the keymap definition--or nil if it is not defined. */
--- 1321,1361 ----
if (i >= cmm_size)
{
+ int newsize, allocsize;
Lisp_Object *newmodes, *newmaps;
! newsize = cmm_size == 0 ? 30 : cmm_size * 2;
! allocsize = newsize * sizeof *newmodes;
!
! /* Use malloc here. See the comment above this function.
! Avoid realloc here; it causes spurious traps on GNU/Linux
[KFS] */
! BLOCK_INPUT;
! newmodes = (Lisp_Object *) malloc (allocsize);
! if (newmodes)
{
! if (cmm_modes)
! {
! bcopy (cmm_modes, newmodes, cmm_size * sizeof
cmm_modes[0]);
! free (cmm_modes);
! }
! cmm_modes = newmodes;
}
! newmaps = (Lisp_Object *) malloc (allocsize);
if (newmaps)
! {
! if (cmm_maps)
! {
! bcopy (cmm_maps, newmaps, cmm_size * sizeof
cmm_maps[0]);
! free (cmm_maps);
! }
! cmm_maps = newmaps;
! }
! UNBLOCK_INPUT;
if (newmodes == NULL || newmaps == NULL)
break;
+ cmm_size = newsize;
}
/* Get the keymap definition--or nil if it is not defined. */