aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2004-09-29 14:22:25 +0000
committerKim F. Storm2004-09-29 14:22:25 +0000
commitad67849eb360efba2796cf45161f3067ca5d9e48 (patch)
tree8d512fdbd1ecdeb3cbca8152249b2f66c5cc414b /src
parentb3b08f03c45f4ed3b1a5eff5b78a4aaea2fa0044 (diff)
downloademacs-ad67849eb360efba2796cf45161f3067ca5d9e48.tar.gz
emacs-ad67849eb360efba2796cf45161f3067ca5d9e48.zip
Remove limit on number of bitmaps.
(fringe_bitmaps, fringe_faces): Change to pointers. (max_fringe_bitmaps): New var. (Fdefine_fringe_bitmap): Expand fringe_bitmaps and fringe_faces. (init_fringe): Allocate fringe_bitmaps and fringe_faces.
Diffstat (limited to 'src')
-rw-r--r--src/fringe.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/src/fringe.c b/src/fringe.c
index b971b6d9847..af2d40b7ee2 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -445,8 +445,9 @@ struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] =
445 { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 }, 445 { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 },
446}; 446};
447 447
448static struct fringe_bitmap *fringe_bitmaps[MAX_FRINGE_BITMAPS]; 448static struct fringe_bitmap **fringe_bitmaps;
449static unsigned fringe_faces[MAX_FRINGE_BITMAPS]; 449static unsigned *fringe_faces;
450static int max_fringe_bitmaps;
450 451
451static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; 452static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
452 453
@@ -1192,8 +1193,6 @@ If BITMAP already exists, the existing definition is replaced. */)
1192 1193
1193 CHECK_SYMBOL (bitmap); 1194 CHECK_SYMBOL (bitmap);
1194 1195
1195 n = lookup_fringe_bitmap (bitmap);
1196
1197 if (!STRINGP (bits) && !VECTORP (bits)) 1196 if (!STRINGP (bits) && !VECTORP (bits))
1198 bits = wrong_type_argument (Qstringp, bits); 1197 bits = wrong_type_argument (Qstringp, bits);
1199 1198
@@ -1245,19 +1244,38 @@ If BITMAP already exists, the existing definition is replaced. */)
1245 else if (!NILP (align) && !EQ (align, Qcenter)) 1244 else if (!NILP (align) && !EQ (align, Qcenter))
1246 error ("Bad align argument"); 1245 error ("Bad align argument");
1247 1246
1247 n = lookup_fringe_bitmap (bitmap);
1248 if (!n) 1248 if (!n)
1249 { 1249 {
1250 if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS) 1250 if (max_used_fringe_bitmap < max_fringe_bitmaps)
1251 n = max_used_fringe_bitmap++; 1251 n = max_used_fringe_bitmap++;
1252 else 1252 else
1253 { 1253 {
1254 for (n = MAX_STANDARD_FRINGE_BITMAPS; 1254 for (n = MAX_STANDARD_FRINGE_BITMAPS;
1255 n < MAX_FRINGE_BITMAPS; 1255 n < max_fringe_bitmaps;
1256 n++) 1256 n++)
1257 if (fringe_bitmaps[n] == NULL) 1257 if (fringe_bitmaps[n] == NULL)
1258 break; 1258 break;
1259 if (n == MAX_FRINGE_BITMAPS) 1259
1260 error ("Cannot define more fringe bitmaps"); 1260 if (n == max_fringe_bitmaps)
1261 {
1262 if ((max_fringe_bitmaps + 20) > MAX_FRINGE_BITMAPS)
1263 error ("No free fringe bitmap slots");
1264
1265 i = max_fringe_bitmaps;
1266 max_fringe_bitmaps += 20;
1267 fringe_bitmaps
1268 = ((struct fringe_bitmap **)
1269 xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *)));
1270 fringe_faces
1271 = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned));
1272
1273 for (; i < max_fringe_bitmaps; i++)
1274 {
1275 fringe_bitmaps[i] = NULL;
1276 fringe_faces[i] = FRINGE_FACE_ID;
1277 }
1278 }
1261 } 1279 }
1262 1280
1263 Vfringe_bitmaps = Fcons (bitmap, Vfringe_bitmaps); 1281 Vfringe_bitmaps = Fcons (bitmap, Vfringe_bitmaps);
@@ -1405,9 +1423,18 @@ init_fringe ()
1405{ 1423{
1406 int i; 1424 int i;
1407 1425
1408 bzero (fringe_bitmaps, sizeof fringe_bitmaps); 1426 max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
1409 for (i = 0; i < MAX_FRINGE_BITMAPS; i++) 1427
1410 fringe_faces[i] = FRINGE_FACE_ID; 1428 fringe_bitmaps
1429 = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
1430 fringe_faces
1431 = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned));
1432
1433 for (i = 0; i < max_fringe_bitmaps; i++)
1434 {
1435 fringe_bitmaps[i] = NULL;
1436 fringe_faces[i] = FRINGE_FACE_ID;
1437 }
1411} 1438}
1412 1439
1413#ifdef HAVE_NTGUI 1440#ifdef HAVE_NTGUI