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/lread.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/lread.c')
| -rw-r--r-- | src/lread.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/lread.c b/src/lread.c index aaab4fd8f64..6900e337c7c 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -695,9 +695,9 @@ Return t if file exists. */) | |||
| 695 | 695 | ||
| 696 | /* Avoid weird lossage with null string as arg, | 696 | /* Avoid weird lossage with null string as arg, |
| 697 | since it would try to load a directory as a Lisp file */ | 697 | since it would try to load a directory as a Lisp file */ |
| 698 | if (XSTRING (file)->size > 0) | 698 | if (SCHARS (file) > 0) |
| 699 | { | 699 | { |
| 700 | int size = STRING_BYTES (XSTRING (file)); | 700 | int size = SBYTES (file); |
| 701 | Lisp_Object tmp[2]; | 701 | Lisp_Object tmp[2]; |
| 702 | 702 | ||
| 703 | GCPRO1 (file); | 703 | GCPRO1 (file); |
| @@ -706,10 +706,10 @@ Return t if file exists. */) | |||
| 706 | { | 706 | { |
| 707 | /* Don't insist on adding a suffix if FILE already ends with one. */ | 707 | /* Don't insist on adding a suffix if FILE already ends with one. */ |
| 708 | if (size > 3 | 708 | if (size > 3 |
| 709 | && !strcmp (XSTRING (file)->data + size - 3, ".el")) | 709 | && !strcmp (SDATA (file) + size - 3, ".el")) |
| 710 | must_suffix = Qnil; | 710 | must_suffix = Qnil; |
| 711 | else if (size > 4 | 711 | else if (size > 4 |
| 712 | && !strcmp (XSTRING (file)->data + size - 4, ".elc")) | 712 | && !strcmp (SDATA (file) + size - 4, ".elc")) |
| 713 | must_suffix = Qnil; | 713 | must_suffix = Qnil; |
| 714 | /* Don't insist on adding a suffix | 714 | /* Don't insist on adding a suffix |
| 715 | if the argument includes a directory name. */ | 715 | if the argument includes a directory name. */ |
| @@ -778,7 +778,7 @@ Return t if file exists. */) | |||
| 778 | Vloads_in_progress = Fcons (found, Vloads_in_progress); | 778 | Vloads_in_progress = Fcons (found, Vloads_in_progress); |
| 779 | } | 779 | } |
| 780 | 780 | ||
| 781 | if (!bcmp (&(XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 4]), | 781 | if (!bcmp (&(SREF (found, SBYTES (found) - 4)), |
| 782 | ".elc", 4)) | 782 | ".elc", 4)) |
| 783 | /* Load .elc files directly, but not when they are | 783 | /* Load .elc files directly, but not when they are |
| 784 | remote and have no handler! */ | 784 | remote and have no handler! */ |
| @@ -793,7 +793,7 @@ Return t if file exists. */) | |||
| 793 | safe_p = 0; | 793 | safe_p = 0; |
| 794 | if (!load_dangerous_libraries) | 794 | if (!load_dangerous_libraries) |
| 795 | error ("File `%s' was not compiled in Emacs", | 795 | error ("File `%s' was not compiled in Emacs", |
| 796 | XSTRING (found)->data); | 796 | SDATA (found)); |
| 797 | else if (!NILP (nomessage)) | 797 | else if (!NILP (nomessage)) |
| 798 | message_with_string ("File `%s' not compiled in Emacs", found, 1); | 798 | message_with_string ("File `%s' not compiled in Emacs", found, 1); |
| 799 | } | 799 | } |
| @@ -806,10 +806,10 @@ Return t if file exists. */) | |||
| 806 | #ifdef DOS_NT | 806 | #ifdef DOS_NT |
| 807 | fmode = "rb"; | 807 | fmode = "rb"; |
| 808 | #endif /* DOS_NT */ | 808 | #endif /* DOS_NT */ |
| 809 | stat ((char *)XSTRING (efound)->data, &s1); | 809 | stat ((char *)SDATA (efound), &s1); |
| 810 | XSTRING (efound)->data[STRING_BYTES (XSTRING (efound)) - 1] = 0; | 810 | SREF (efound, SBYTES (efound) - 1) = 0; |
| 811 | result = stat ((char *)XSTRING (efound)->data, &s2); | 811 | result = stat ((char *)SDATA (efound), &s2); |
| 812 | XSTRING (efound)->data[STRING_BYTES (XSTRING (efound)) - 1] = 'c'; | 812 | SREF (efound, SBYTES (efound) - 1) = 'c'; |
| 813 | UNGCPRO; | 813 | UNGCPRO; |
| 814 | 814 | ||
| 815 | if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime) | 815 | if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime) |
| @@ -823,7 +823,7 @@ Return t if file exists. */) | |||
| 823 | Lisp_Object file; | 823 | Lisp_Object file; |
| 824 | file = Fsubstring (found, make_number (0), make_number (-1)); | 824 | file = Fsubstring (found, make_number (0), make_number (-1)); |
| 825 | message_with_string ("Source file `%s' newer than byte-compiled file", | 825 | message_with_string ("Source file `%s' newer than byte-compiled file", |
| 826 | file, SMBP (file)); | 826 | file, STRING_MULTIBYTE (file)); |
| 827 | } | 827 | } |
| 828 | } | 828 | } |
| 829 | } | 829 | } |
| @@ -848,7 +848,7 @@ Return t if file exists. */) | |||
| 848 | emacs_close (fd); | 848 | emacs_close (fd); |
| 849 | GCPRO1 (efound); | 849 | GCPRO1 (efound); |
| 850 | efound = ENCODE_FILE (found); | 850 | efound = ENCODE_FILE (found); |
| 851 | stream = fopen ((char *) XSTRING (efound)->data, fmode); | 851 | stream = fopen ((char *) SDATA (efound), fmode); |
| 852 | UNGCPRO; | 852 | UNGCPRO; |
| 853 | #else /* not WINDOWSNT */ | 853 | #else /* not WINDOWSNT */ |
| 854 | stream = fdopen (fd, fmode); | 854 | stream = fdopen (fd, fmode); |
| @@ -856,7 +856,7 @@ Return t if file exists. */) | |||
| 856 | if (stream == 0) | 856 | if (stream == 0) |
| 857 | { | 857 | { |
| 858 | emacs_close (fd); | 858 | emacs_close (fd); |
| 859 | error ("Failure to create stdio stream for %s", XSTRING (file)->data); | 859 | error ("Failure to create stdio stream for %s", SDATA (file)); |
| 860 | } | 860 | } |
| 861 | 861 | ||
| 862 | if (! NILP (Vpurify_flag)) | 862 | if (! NILP (Vpurify_flag)) |
| @@ -958,9 +958,9 @@ static int | |||
| 958 | complete_filename_p (pathname) | 958 | complete_filename_p (pathname) |
| 959 | Lisp_Object pathname; | 959 | Lisp_Object pathname; |
| 960 | { | 960 | { |
| 961 | register unsigned char *s = XSTRING (pathname)->data; | 961 | register unsigned char *s = SDATA (pathname); |
| 962 | return (IS_DIRECTORY_SEP (s[0]) | 962 | return (IS_DIRECTORY_SEP (s[0]) |
| 963 | || (XSTRING (pathname)->size > 2 | 963 | || (SCHARS (pathname) > 2 |
| 964 | && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2])) | 964 | && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2])) |
| 965 | #ifdef ALTOS | 965 | #ifdef ALTOS |
| 966 | || *s == '@' | 966 | || *s == '@' |
| @@ -1032,7 +1032,7 @@ openp (path, str, suffixes, storeptr, predicate) | |||
| 1032 | { | 1032 | { |
| 1033 | CHECK_STRING_CAR (tail); | 1033 | CHECK_STRING_CAR (tail); |
| 1034 | max_suffix_len = max (max_suffix_len, | 1034 | max_suffix_len = max (max_suffix_len, |
| 1035 | STRING_BYTES (XSTRING (XCAR (tail)))); | 1035 | SBYTES (XCAR (tail))); |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | string = filename = Qnil; | 1038 | string = filename = Qnil; |
| @@ -1060,7 +1060,7 @@ openp (path, str, suffixes, storeptr, predicate) | |||
| 1060 | 1060 | ||
| 1061 | /* Calculate maximum size of any filename made from | 1061 | /* Calculate maximum size of any filename made from |
| 1062 | this path element/specified file name and any possible suffix. */ | 1062 | this path element/specified file name and any possible suffix. */ |
| 1063 | want_size = max_suffix_len + STRING_BYTES (XSTRING (filename)) + 1; | 1063 | want_size = max_suffix_len + SBYTES (filename) + 1; |
| 1064 | if (fn_size < want_size) | 1064 | if (fn_size < want_size) |
| 1065 | fn = (char *) alloca (fn_size = 100 + want_size); | 1065 | fn = (char *) alloca (fn_size = 100 + want_size); |
| 1066 | 1066 | ||
| @@ -1068,29 +1068,29 @@ openp (path, str, suffixes, storeptr, predicate) | |||
| 1068 | for (tail = NILP (suffixes) ? default_suffixes : suffixes; | 1068 | for (tail = NILP (suffixes) ? default_suffixes : suffixes; |
| 1069 | CONSP (tail); tail = XCDR (tail)) | 1069 | CONSP (tail); tail = XCDR (tail)) |
| 1070 | { | 1070 | { |
| 1071 | int lsuffix = STRING_BYTES (XSTRING (XCAR (tail))); | 1071 | int lsuffix = SBYTES (XCAR (tail)); |
| 1072 | Lisp_Object handler; | 1072 | Lisp_Object handler; |
| 1073 | int exists; | 1073 | int exists; |
| 1074 | 1074 | ||
| 1075 | /* Concatenate path element/specified name with the suffix. | 1075 | /* Concatenate path element/specified name with the suffix. |
| 1076 | If the directory starts with /:, remove that. */ | 1076 | If the directory starts with /:, remove that. */ |
| 1077 | if (XSTRING (filename)->size > 2 | 1077 | if (SCHARS (filename) > 2 |
| 1078 | && XSTRING (filename)->data[0] == '/' | 1078 | && SREF (filename, 0) == '/' |
| 1079 | && XSTRING (filename)->data[1] == ':') | 1079 | && SREF (filename, 1) == ':') |
| 1080 | { | 1080 | { |
| 1081 | strncpy (fn, XSTRING (filename)->data + 2, | 1081 | strncpy (fn, SDATA (filename) + 2, |
| 1082 | STRING_BYTES (XSTRING (filename)) - 2); | 1082 | SBYTES (filename) - 2); |
| 1083 | fn[STRING_BYTES (XSTRING (filename)) - 2] = 0; | 1083 | fn[SBYTES (filename) - 2] = 0; |
| 1084 | } | 1084 | } |
| 1085 | else | 1085 | else |
| 1086 | { | 1086 | { |
| 1087 | strncpy (fn, XSTRING (filename)->data, | 1087 | strncpy (fn, SDATA (filename), |
| 1088 | STRING_BYTES (XSTRING (filename))); | 1088 | SBYTES (filename)); |
| 1089 | fn[STRING_BYTES (XSTRING (filename))] = 0; | 1089 | fn[SBYTES (filename)] = 0; |
| 1090 | } | 1090 | } |
| 1091 | 1091 | ||
| 1092 | if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ | 1092 | if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ |
| 1093 | strncat (fn, XSTRING (XCAR (tail))->data, lsuffix); | 1093 | strncat (fn, SDATA (XCAR (tail)), lsuffix); |
| 1094 | 1094 | ||
| 1095 | /* Check that the file exists and is not a directory. */ | 1095 | /* Check that the file exists and is not a directory. */ |
| 1096 | /* We used to only check for handlers on non-absolute file names: | 1096 | /* We used to only check for handlers on non-absolute file names: |
| @@ -1125,7 +1125,7 @@ openp (path, str, suffixes, storeptr, predicate) | |||
| 1125 | char *pfn; | 1125 | char *pfn; |
| 1126 | 1126 | ||
| 1127 | encoded_fn = ENCODE_FILE (string); | 1127 | encoded_fn = ENCODE_FILE (string); |
| 1128 | pfn = XSTRING (encoded_fn)->data; | 1128 | pfn = SDATA (encoded_fn); |
| 1129 | exists = (stat (pfn, &st) >= 0 | 1129 | exists = (stat (pfn, &st) >= 0 |
| 1130 | && (st.st_mode & S_IFMT) != S_IFDIR); | 1130 | && (st.st_mode & S_IFMT) != S_IFDIR); |
| 1131 | if (exists) | 1131 | if (exists) |
| @@ -1507,12 +1507,12 @@ read_internal_start (stream, start, end) | |||
| 1507 | { | 1507 | { |
| 1508 | int startval, endval; | 1508 | int startval, endval; |
| 1509 | if (NILP (end)) | 1509 | if (NILP (end)) |
| 1510 | endval = XSTRING (stream)->size; | 1510 | endval = SCHARS (stream); |
| 1511 | else | 1511 | else |
| 1512 | { | 1512 | { |
| 1513 | CHECK_NUMBER (end); | 1513 | CHECK_NUMBER (end); |
| 1514 | endval = XINT (end); | 1514 | endval = XINT (end); |
| 1515 | if (endval < 0 || endval > XSTRING (stream)->size) | 1515 | if (endval < 0 || endval > SCHARS (stream)) |
| 1516 | args_out_of_range (stream, end); | 1516 | args_out_of_range (stream, end); |
| 1517 | } | 1517 | } |
| 1518 | 1518 | ||
| @@ -1963,17 +1963,17 @@ read1 (readcharfun, pch, first_in_list) | |||
| 1963 | 1963 | ||
| 1964 | UNREAD (c); | 1964 | UNREAD (c); |
| 1965 | tmp = read1 (readcharfun, pch, first_in_list); | 1965 | tmp = read1 (readcharfun, pch, first_in_list); |
| 1966 | if (size_in_chars != XSTRING (tmp)->size | 1966 | if (size_in_chars != SCHARS (tmp) |
| 1967 | /* We used to print 1 char too many | 1967 | /* We used to print 1 char too many |
| 1968 | when the number of bits was a multiple of 8. | 1968 | when the number of bits was a multiple of 8. |
| 1969 | Accept such input in case it came from an old version. */ | 1969 | Accept such input in case it came from an old version. */ |
| 1970 | && ! (XFASTINT (length) | 1970 | && ! (XFASTINT (length) |
| 1971 | == (XSTRING (tmp)->size - 1) * BITS_PER_CHAR)) | 1971 | == (SCHARS (tmp) - 1) * BITS_PER_CHAR)) |
| 1972 | Fsignal (Qinvalid_read_syntax, | 1972 | Fsignal (Qinvalid_read_syntax, |
| 1973 | Fcons (make_string ("#&...", 5), Qnil)); | 1973 | Fcons (make_string ("#&...", 5), Qnil)); |
| 1974 | 1974 | ||
| 1975 | val = Fmake_bool_vector (length, Qnil); | 1975 | val = Fmake_bool_vector (length, Qnil); |
| 1976 | bcopy (XSTRING (tmp)->data, XBOOL_VECTOR (val)->data, | 1976 | bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, |
| 1977 | size_in_chars); | 1977 | size_in_chars); |
| 1978 | /* Clear the extraneous bits in the last byte. */ | 1978 | /* Clear the extraneous bits in the last byte. */ |
| 1979 | if (XINT (length) != size_in_chars * BITS_PER_CHAR) | 1979 | if (XINT (length) != size_in_chars * BITS_PER_CHAR) |
| @@ -2614,7 +2614,7 @@ substitute_object_recurse (object, placeholder, subtree) | |||
| 2614 | /* Check for text properties in each interval. | 2614 | /* Check for text properties in each interval. |
| 2615 | substitute_in_interval contains part of the logic. */ | 2615 | substitute_in_interval contains part of the logic. */ |
| 2616 | 2616 | ||
| 2617 | INTERVAL root_interval = XSTRING (subtree)->intervals; | 2617 | INTERVAL root_interval = STRING_INTERVALS (subtree); |
| 2618 | Lisp_Object arg = Fcons (object, placeholder); | 2618 | Lisp_Object arg = Fcons (object, placeholder); |
| 2619 | 2619 | ||
| 2620 | traverse_intervals_noorder (root_interval, | 2620 | traverse_intervals_noorder (root_interval, |
| @@ -2760,8 +2760,8 @@ read_vector (readcharfun, bytecodeflag) | |||
| 2760 | /* Coerce string to unibyte (like string-as-unibyte, | 2760 | /* Coerce string to unibyte (like string-as-unibyte, |
| 2761 | but without generating extra garbage and | 2761 | but without generating extra garbage and |
| 2762 | guaranteeing no change in the contents). */ | 2762 | guaranteeing no change in the contents). */ |
| 2763 | XSTRING (bytestr)->size = STRING_BYTES (XSTRING (bytestr)); | 2763 | SCHARS (bytestr) = SBYTES (bytestr); |
| 2764 | SET_STRING_BYTES (XSTRING (bytestr), -1); | 2764 | STRING_SET_UNIBYTE (bytestr); |
| 2765 | 2765 | ||
| 2766 | item = Fread (bytestr); | 2766 | item = Fread (bytestr); |
| 2767 | if (!CONSP (item)) | 2767 | if (!CONSP (item)) |
| @@ -3040,9 +3040,9 @@ it defaults to the value of `obarray'. */) | |||
| 3040 | 3040 | ||
| 3041 | CHECK_STRING (string); | 3041 | CHECK_STRING (string); |
| 3042 | 3042 | ||
| 3043 | tem = oblookup (obarray, XSTRING (string)->data, | 3043 | tem = oblookup (obarray, SDATA (string), |
| 3044 | XSTRING (string)->size, | 3044 | SCHARS (string), |
| 3045 | STRING_BYTES (XSTRING (string))); | 3045 | SBYTES (string)); |
| 3046 | if (!INTEGERP (tem)) | 3046 | if (!INTEGERP (tem)) |
| 3047 | return tem; | 3047 | return tem; |
| 3048 | 3048 | ||
| @@ -3055,7 +3055,7 @@ it defaults to the value of `obarray'. */) | |||
| 3055 | else | 3055 | else |
| 3056 | XSYMBOL (sym)->interned = SYMBOL_INTERNED; | 3056 | XSYMBOL (sym)->interned = SYMBOL_INTERNED; |
| 3057 | 3057 | ||
| 3058 | if ((XSTRING (string)->data[0] == ':') | 3058 | if ((SREF (string, 0) == ':') |
| 3059 | && EQ (obarray, initial_obarray)) | 3059 | && EQ (obarray, initial_obarray)) |
| 3060 | { | 3060 | { |
| 3061 | XSYMBOL (sym)->constant = 1; | 3061 | XSYMBOL (sym)->constant = 1; |
| @@ -3124,9 +3124,9 @@ OBARRAY defaults to the value of the variable `obarray'. */) | |||
| 3124 | string = name; | 3124 | string = name; |
| 3125 | } | 3125 | } |
| 3126 | 3126 | ||
| 3127 | tem = oblookup (obarray, XSTRING (string)->data, | 3127 | tem = oblookup (obarray, SDATA (string), |
| 3128 | XSTRING (string)->size, | 3128 | SCHARS (string), |
| 3129 | STRING_BYTES (XSTRING (string))); | 3129 | SBYTES (string)); |
| 3130 | if (INTEGERP (tem)) | 3130 | if (INTEGERP (tem)) |
| 3131 | return Qnil; | 3131 | return Qnil; |
| 3132 | /* If arg was a symbol, don't delete anything but that symbol itself. */ | 3132 | /* If arg was a symbol, don't delete anything but that symbol itself. */ |
| @@ -3203,9 +3203,9 @@ oblookup (obarray, ptr, size, size_byte) | |||
| 3203 | else | 3203 | else |
| 3204 | for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next)) | 3204 | for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next)) |
| 3205 | { | 3205 | { |
| 3206 | if (STRING_BYTES (XSTRING (SYMBOL_NAME (tail))) == size_byte | 3206 | if (SBYTES (SYMBOL_NAME (tail)) == size_byte |
| 3207 | && XSTRING (SYMBOL_NAME (tail))->size == size | 3207 | && SCHARS (SYMBOL_NAME (tail)) == size |
| 3208 | && !bcmp (XSTRING (SYMBOL_NAME (tail))->data, ptr, size_byte)) | 3208 | && !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte)) |
| 3209 | return tail; | 3209 | return tail; |
| 3210 | else if (XSYMBOL (tail)->next == 0) | 3210 | else if (XSYMBOL (tail)->next == 0) |
| 3211 | break; | 3211 | break; |
| @@ -3618,7 +3618,7 @@ init_lread () | |||
| 3618 | if (STRINGP (dirfile)) | 3618 | if (STRINGP (dirfile)) |
| 3619 | { | 3619 | { |
| 3620 | dirfile = Fdirectory_file_name (dirfile); | 3620 | dirfile = Fdirectory_file_name (dirfile); |
| 3621 | if (access (XSTRING (dirfile)->data, 0) < 0) | 3621 | if (access (SDATA (dirfile), 0) < 0) |
| 3622 | dir_warning ("Warning: Lisp directory `%s' does not exist.\n", | 3622 | dir_warning ("Warning: Lisp directory `%s' does not exist.\n", |
| 3623 | XCAR (path_tail)); | 3623 | XCAR (path_tail)); |
| 3624 | } | 3624 | } |
| @@ -3654,10 +3654,10 @@ dir_warning (format, dirname) | |||
| 3654 | Lisp_Object dirname; | 3654 | Lisp_Object dirname; |
| 3655 | { | 3655 | { |
| 3656 | char *buffer | 3656 | char *buffer |
| 3657 | = (char *) alloca (XSTRING (dirname)->size + strlen (format) + 5); | 3657 | = (char *) alloca (SCHARS (dirname) + strlen (format) + 5); |
| 3658 | 3658 | ||
| 3659 | fprintf (stderr, format, XSTRING (dirname)->data); | 3659 | fprintf (stderr, format, SDATA (dirname)); |
| 3660 | sprintf (buffer, format, XSTRING (dirname)->data); | 3660 | sprintf (buffer, format, SDATA (dirname)); |
| 3661 | /* Don't log the warning before we've initialized!! */ | 3661 | /* Don't log the warning before we've initialized!! */ |
| 3662 | if (initialized) | 3662 | if (initialized) |
| 3663 | message_dolog (buffer, strlen (buffer), 0, STRING_MULTIBYTE (dirname)); | 3663 | message_dolog (buffer, strlen (buffer), 0, STRING_MULTIBYTE (dirname)); |