diff options
| author | Ken Raeburn | 2002-07-15 00:01:34 +0000 |
|---|---|---|
| committer | Ken Raeburn | 2002-07-15 00:01:34 +0000 |
| commit | d5db40779d7505244d37476b4f046641f07eea2b (patch) | |
| tree | 5c8bf4dad41639287e722cb7cbdc0709e47a9e53 /src/xmenu.c | |
| parent | 491c2516d32fa8b9ba9422ec142c8925dd82af00 (diff) | |
| download | emacs-d5db40779d7505244d37476b4f046641f07eea2b.tar.gz emacs-d5db40779d7505244d37476b4f046641f07eea2b.zip | |
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
SCHARS, SBYTES, STRING_INTERVALS, SREF, SDATA; explicit size_byte references
left unchanged for now.
Diffstat (limited to 'src/xmenu.c')
| -rw-r--r-- | src/xmenu.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 35ddfe9258a..cc613bedeb1 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -505,7 +505,7 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth, | |||
| 505 | enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; | 505 | enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; |
| 506 | item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; | 506 | item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; |
| 507 | 507 | ||
| 508 | if (!NILP (map) && XSTRING (item_string)->data[0] == '@') | 508 | if (!NILP (map) && SREF (item_string, 0) == '@') |
| 509 | { | 509 | { |
| 510 | if (!NILP (enabled)) | 510 | if (!NILP (enabled)) |
| 511 | /* An enabled separate pane. Remember this to handle it later. */ | 511 | /* An enabled separate pane. Remember this to handle it later. */ |
| @@ -551,8 +551,8 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth, | |||
| 551 | index++; /* Skip a left, right divider. */ | 551 | index++; /* Skip a left, right divider. */ |
| 552 | else | 552 | else |
| 553 | { | 553 | { |
| 554 | if (!submenu && XSTRING (tem)->data[0] != '\0' | 554 | if (!submenu && SREF (tem, 0) != '\0' |
| 555 | && XSTRING (tem)->data[0] != '-') | 555 | && SREF (tem, 0) != '-') |
| 556 | XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME] | 556 | XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME] |
| 557 | = concat2 (build_string (" "), tem); | 557 | = concat2 (build_string (" "), tem); |
| 558 | index += MENU_ITEMS_ITEM_LENGTH; | 558 | index += MENU_ITEMS_ITEM_LENGTH; |
| @@ -568,8 +568,8 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth, | |||
| 568 | prefix = build_string (NILP (selected) ? "( ) " : "(*) "); | 568 | prefix = build_string (NILP (selected) ? "( ) " : "(*) "); |
| 569 | } | 569 | } |
| 570 | /* Not a button. If we have earlier buttons, then we need a prefix. */ | 570 | /* Not a button. If we have earlier buttons, then we need a prefix. */ |
| 571 | else if (!*notbuttons_ptr && XSTRING (item_string)->data[0] != '\0' | 571 | else if (!*notbuttons_ptr && SREF (item_string, 0) != '\0' |
| 572 | && XSTRING (item_string)->data[0] != '-') | 572 | && SREF (item_string, 0) != '-') |
| 573 | prefix = build_string (" "); | 573 | prefix = build_string (" "); |
| 574 | 574 | ||
| 575 | if (!NILP (prefix)) | 575 | if (!NILP (prefix)) |
| @@ -1453,7 +1453,7 @@ single_submenu (item_key, item_name, maps) | |||
| 1453 | } | 1453 | } |
| 1454 | #endif | 1454 | #endif |
| 1455 | pane_string = (NILP (pane_name) | 1455 | pane_string = (NILP (pane_name) |
| 1456 | ? "" : (char *) XSTRING (pane_name)->data); | 1456 | ? "" : (char *) SDATA (pane_name)); |
| 1457 | /* If there is just one top-level pane, put all its items directly | 1457 | /* If there is just one top-level pane, put all its items directly |
| 1458 | under the top-level menu. */ | 1458 | under the top-level menu. */ |
| 1459 | if (menu_items_n_panes == 1) | 1459 | if (menu_items_n_panes == 1) |
| @@ -1517,9 +1517,9 @@ single_submenu (item_key, item_name, maps) | |||
| 1517 | else | 1517 | else |
| 1518 | save_wv->contents = wv; | 1518 | save_wv->contents = wv; |
| 1519 | 1519 | ||
| 1520 | wv->name = (char *) XSTRING (item_name)->data; | 1520 | wv->name = (char *) SDATA (item_name); |
| 1521 | if (!NILP (descrip)) | 1521 | if (!NILP (descrip)) |
| 1522 | wv->key = (char *) XSTRING (descrip)->data; | 1522 | wv->key = (char *) SDATA (descrip); |
| 1523 | wv->value = 0; | 1523 | wv->value = 0; |
| 1524 | /* The EMACS_INT cast avoids a warning. There's no problem | 1524 | /* The EMACS_INT cast avoids a warning. There's no problem |
| 1525 | as long as pointers have enough bits to hold small integers. */ | 1525 | as long as pointers have enough bits to hold small integers. */ |
| @@ -1753,7 +1753,7 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1753 | string = XVECTOR (items)->contents[i + 1]; | 1753 | string = XVECTOR (items)->contents[i + 1]; |
| 1754 | if (NILP (string)) | 1754 | if (NILP (string)) |
| 1755 | break; | 1755 | break; |
| 1756 | wv->name = (char *) XSTRING (string)->data; | 1756 | wv->name = (char *) SDATA (string); |
| 1757 | wv = wv->next; | 1757 | wv = wv->next; |
| 1758 | } | 1758 | } |
| 1759 | 1759 | ||
| @@ -1776,7 +1776,7 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1776 | break; | 1776 | break; |
| 1777 | 1777 | ||
| 1778 | wv = xmalloc_widget_value (); | 1778 | wv = xmalloc_widget_value (); |
| 1779 | wv->name = (char *) XSTRING (string)->data; | 1779 | wv->name = (char *) SDATA (string); |
| 1780 | wv->value = 0; | 1780 | wv->value = 0; |
| 1781 | wv->enabled = 1; | 1781 | wv->enabled = 1; |
| 1782 | wv->button_type = BUTTON_TYPE_NONE; | 1782 | wv->button_type = BUTTON_TYPE_NONE; |
| @@ -2051,7 +2051,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2051 | } | 2051 | } |
| 2052 | #endif | 2052 | #endif |
| 2053 | pane_string = (NILP (pane_name) | 2053 | pane_string = (NILP (pane_name) |
| 2054 | ? "" : (char *) XSTRING (pane_name)->data); | 2054 | ? "" : (char *) SDATA (pane_name)); |
| 2055 | /* If there is just one top-level pane, put all its items directly | 2055 | /* If there is just one top-level pane, put all its items directly |
| 2056 | under the top-level menu. */ | 2056 | under the top-level menu. */ |
| 2057 | if (menu_items_n_panes == 1) | 2057 | if (menu_items_n_panes == 1) |
| @@ -2116,9 +2116,9 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2116 | prev_wv->next = wv; | 2116 | prev_wv->next = wv; |
| 2117 | else | 2117 | else |
| 2118 | save_wv->contents = wv; | 2118 | save_wv->contents = wv; |
| 2119 | wv->name = (char *) XSTRING (item_name)->data; | 2119 | wv->name = (char *) SDATA (item_name); |
| 2120 | if (!NILP (descrip)) | 2120 | if (!NILP (descrip)) |
| 2121 | wv->key = (char *) XSTRING (descrip)->data; | 2121 | wv->key = (char *) SDATA (descrip); |
| 2122 | wv->value = 0; | 2122 | wv->value = 0; |
| 2123 | /* If this item has a null value, | 2123 | /* If this item has a null value, |
| 2124 | make the call_data null so that it won't display a box | 2124 | make the call_data null so that it won't display a box |
| @@ -2169,7 +2169,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2169 | title = ENCODE_SYSTEM (title); | 2169 | title = ENCODE_SYSTEM (title); |
| 2170 | #endif | 2170 | #endif |
| 2171 | 2171 | ||
| 2172 | wv_title->name = (char *) XSTRING (title)->data; | 2172 | wv_title->name = (char *) SDATA (title); |
| 2173 | wv_title->enabled = TRUE; | 2173 | wv_title->enabled = TRUE; |
| 2174 | wv_title->button_type = BUTTON_TYPE_NONE; | 2174 | wv_title->button_type = BUTTON_TYPE_NONE; |
| 2175 | wv_title->next = wv_sep1; | 2175 | wv_title->next = wv_sep1; |
| @@ -2370,7 +2370,7 @@ xdialog_show (f, keymaps, title, error) | |||
| 2370 | pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; | 2370 | pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; |
| 2371 | prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; | 2371 | prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; |
| 2372 | pane_string = (NILP (pane_name) | 2372 | pane_string = (NILP (pane_name) |
| 2373 | ? "" : (char *) XSTRING (pane_name)->data); | 2373 | ? "" : (char *) SDATA (pane_name)); |
| 2374 | prev_wv = xmalloc_widget_value (); | 2374 | prev_wv = xmalloc_widget_value (); |
| 2375 | prev_wv->value = pane_string; | 2375 | prev_wv->value = pane_string; |
| 2376 | if (keymaps && !NILP (prefix)) | 2376 | if (keymaps && !NILP (prefix)) |
| @@ -2417,8 +2417,8 @@ xdialog_show (f, keymaps, title, error) | |||
| 2417 | prev_wv->next = wv; | 2417 | prev_wv->next = wv; |
| 2418 | wv->name = (char *) button_names[nb_buttons]; | 2418 | wv->name = (char *) button_names[nb_buttons]; |
| 2419 | if (!NILP (descrip)) | 2419 | if (!NILP (descrip)) |
| 2420 | wv->key = (char *) XSTRING (descrip)->data; | 2420 | wv->key = (char *) SDATA (descrip); |
| 2421 | wv->value = (char *) XSTRING (item_name)->data; | 2421 | wv->value = (char *) SDATA (item_name); |
| 2422 | wv->call_data = (void *) &XVECTOR (menu_items)->contents[i]; | 2422 | wv->call_data = (void *) &XVECTOR (menu_items)->contents[i]; |
| 2423 | wv->enabled = !NILP (enable); | 2423 | wv->enabled = !NILP (enable); |
| 2424 | wv->help = Qnil; | 2424 | wv->help = Qnil; |
| @@ -2656,7 +2656,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2656 | pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; | 2656 | pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; |
| 2657 | prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; | 2657 | prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
| 2658 | pane_string = (NILP (pane_name) | 2658 | pane_string = (NILP (pane_name) |
| 2659 | ? "" : (char *) XSTRING (pane_name)->data); | 2659 | ? "" : (char *) SDATA (pane_name)); |
| 2660 | if (keymaps && !NILP (prefix)) | 2660 | if (keymaps && !NILP (prefix)) |
| 2661 | pane_string++; | 2661 | pane_string++; |
| 2662 | 2662 | ||
| @@ -2683,7 +2683,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2683 | j++; | 2683 | j++; |
| 2684 | continue; | 2684 | continue; |
| 2685 | } | 2685 | } |
| 2686 | width = STRING_BYTES (XSTRING (item)); | 2686 | width = SBYTES (item); |
| 2687 | if (width > maxwidth) | 2687 | if (width > maxwidth) |
| 2688 | maxwidth = width; | 2688 | maxwidth = width; |
| 2689 | 2689 | ||
| @@ -2706,34 +2706,34 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2706 | descrip | 2706 | descrip |
| 2707 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; | 2707 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; |
| 2708 | help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; | 2708 | help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; |
| 2709 | help_string = STRINGP (help) ? XSTRING (help)->data : NULL; | 2709 | help_string = STRINGP (help) ? SDATA (help) : NULL; |
| 2710 | 2710 | ||
| 2711 | if (!NILP (descrip)) | 2711 | if (!NILP (descrip)) |
| 2712 | { | 2712 | { |
| 2713 | int gap = maxwidth - STRING_BYTES (XSTRING (item_name)); | 2713 | int gap = maxwidth - SBYTES (item_name); |
| 2714 | #ifdef C_ALLOCA | 2714 | #ifdef C_ALLOCA |
| 2715 | Lisp_Object spacer; | 2715 | Lisp_Object spacer; |
| 2716 | spacer = Fmake_string (make_number (gap), make_number (' ')); | 2716 | spacer = Fmake_string (make_number (gap), make_number (' ')); |
| 2717 | item_name = concat2 (item_name, spacer); | 2717 | item_name = concat2 (item_name, spacer); |
| 2718 | item_name = concat2 (item_name, descrip); | 2718 | item_name = concat2 (item_name, descrip); |
| 2719 | item_data = XSTRING (item_name)->data; | 2719 | item_data = SDATA (item_name); |
| 2720 | #else | 2720 | #else |
| 2721 | /* if alloca is fast, use that to make the space, | 2721 | /* if alloca is fast, use that to make the space, |
| 2722 | to reduce gc needs. */ | 2722 | to reduce gc needs. */ |
| 2723 | item_data | 2723 | item_data |
| 2724 | = (unsigned char *) alloca (maxwidth | 2724 | = (unsigned char *) alloca (maxwidth |
| 2725 | + STRING_BYTES (XSTRING (descrip)) + 1); | 2725 | + SBYTES (descrip) + 1); |
| 2726 | bcopy (XSTRING (item_name)->data, item_data, | 2726 | bcopy (SDATA (item_name), item_data, |
| 2727 | STRING_BYTES (XSTRING (item_name))); | 2727 | SBYTES (item_name)); |
| 2728 | for (j = XSTRING (item_name)->size; j < maxwidth; j++) | 2728 | for (j = SCHARS (item_name); j < maxwidth; j++) |
| 2729 | item_data[j] = ' '; | 2729 | item_data[j] = ' '; |
| 2730 | bcopy (XSTRING (descrip)->data, item_data + j, | 2730 | bcopy (SDATA (descrip), item_data + j, |
| 2731 | STRING_BYTES (XSTRING (descrip))); | 2731 | SBYTES (descrip)); |
| 2732 | item_data[j + STRING_BYTES (XSTRING (descrip))] = 0; | 2732 | item_data[j + SBYTES (descrip)] = 0; |
| 2733 | #endif | 2733 | #endif |
| 2734 | } | 2734 | } |
| 2735 | else | 2735 | else |
| 2736 | item_data = XSTRING (item_name)->data; | 2736 | item_data = SDATA (item_name); |
| 2737 | 2737 | ||
| 2738 | if (XMenuAddSelection (FRAME_X_DISPLAY (f), | 2738 | if (XMenuAddSelection (FRAME_X_DISPLAY (f), |
| 2739 | menu, lpane, 0, item_data, | 2739 | menu, lpane, 0, item_data, |