/[emacs]/emacs/src/keymap.c
ViewVC logotype

Diff of /emacs/src/keymap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.259 by kfstorm, Fri May 10 07:03:20 2002 UTC revision 1.260 by kfstorm, Fri May 10 23:57:14 2002 UTC
# Line 1248  silly_event_symbol_error (c) Line 1248  silly_event_symbol_error (c)
1248  /* We can't put these variables inside current_minor_maps, since under  /* We can't put these variables inside current_minor_maps, since under
1249     some systems, static gets macro-defined to be the empty string.     some systems, static gets macro-defined to be the empty string.
1250     Ickypoo.  */     Ickypoo.  */
1251  static Lisp_Object *cmm_modes, *cmm_maps;  static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL;
1252  static int cmm_size;  static int cmm_size = 0;
1253    
1254  /* Error handler used in current_minor_maps.  */  /* Error handler used in current_minor_maps.  */
1255  static Lisp_Object  static Lisp_Object
# Line 1321  current_minor_maps (modeptr, mapptr) Line 1321  current_minor_maps (modeptr, mapptr)
1321    
1322              if (i >= cmm_size)              if (i >= cmm_size)
1323                {                {
1324                    int newsize, allocsize;
1325                  Lisp_Object *newmodes, *newmaps;                  Lisp_Object *newmodes, *newmaps;
1326    
1327                  /* Use malloc/realloc here.  See the comment above                  newsize = cmm_size == 0 ? 30 : cmm_size * 2;
1328                     this function.  */                  allocsize = newsize * sizeof *newmodes;
1329                  if (cmm_maps)  
1330                    {                  /* Use malloc here.  See the comment above this function.
1331                      BLOCK_INPUT;                     Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */
1332                      cmm_size *= 2;                  BLOCK_INPUT;
1333                      newmodes                  newmodes = (Lisp_Object *) malloc (allocsize);
1334                        = (Lisp_Object *) realloc (cmm_modes,                  if (newmodes)
                                                  cmm_size * sizeof *newmodes);  
                     newmaps  
                       = (Lisp_Object *) realloc (cmm_maps,  
                                                  cmm_size * sizeof *newmaps);  
                     UNBLOCK_INPUT;  
                   }  
                 else  
1335                    {                    {
1336                      BLOCK_INPUT;                      if (cmm_modes)
1337                      cmm_size = 30;                        {
1338                      newmodes                          bcopy (cmm_modes, newmodes, cmm_size * sizeof cmm_modes[0]);
1339                        = (Lisp_Object *) malloc (cmm_size * sizeof *newmodes);                          free (cmm_modes);
1340                      newmaps                        }
1341                        = (Lisp_Object *) malloc (cmm_size * sizeof *newmaps);                      cmm_modes = newmodes;
                     UNBLOCK_INPUT;  
1342                    }                    }
1343    
1344                  if (newmodes)                  newmaps = (Lisp_Object *) malloc (allocsize);
                   cmm_modes = newmodes;  
1345                  if (newmaps)                  if (newmaps)
1346                    cmm_maps = newmaps;                    {
1347                        if (cmm_maps)
1348                          {
1349                            bcopy (cmm_maps, newmaps, cmm_size * sizeof cmm_maps[0]);
1350                            free (cmm_maps);
1351                          }
1352                        cmm_maps = newmaps;
1353                      }
1354                    UNBLOCK_INPUT;
1355                                
1356                  if (newmodes == NULL || newmaps == NULL)                  if (newmodes == NULL || newmaps == NULL)
1357                    break;                    break;
1358                    cmm_size = newsize;
1359                }                }
1360    
1361              /* Get the keymap definition--or nil if it is not defined.  */              /* Get the keymap definition--or nil if it is not defined.  */

Legend:
Removed from v.1.259  
changed lines
  Added in v.1.260

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26