diff options
| author | Stefan Monnier | 2003-04-17 22:27:13 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-04-17 22:27:13 +0000 |
| commit | e509f1689ace103dc0860661d599cd25fdb2e766 (patch) | |
| tree | 95a3af88399f08f0d296d06a241aee5b040427d1 /src/eval.c | |
| parent | 8a7bde3e88998e8d0469e291842cd30aa147651b (diff) | |
| download | emacs-e509f1689ace103dc0860661d599cd25fdb2e766.tar.gz emacs-e509f1689ace103dc0860661d599cd25fdb2e766.zip | |
(For, Fand, Fprogn, un_autoload, do_autoload): Use XCDR, XCAR, CONSP.
(Fdefmacro): Fix docstring. Use XCAR, XCDR.
(Fapply): Remove unnecessary GCPRO.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 78 |
1 files changed, 29 insertions, 49 deletions
diff --git a/src/eval.c b/src/eval.c index 373a9ad432b..53272b9bd68 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -294,24 +294,18 @@ usage: (or CONDITIONS ...) */) | |||
| 294 | (args) | 294 | (args) |
| 295 | Lisp_Object args; | 295 | Lisp_Object args; |
| 296 | { | 296 | { |
| 297 | register Lisp_Object val; | 297 | register Lisp_Object val = Qnil; |
| 298 | Lisp_Object args_left; | ||
| 299 | struct gcpro gcpro1; | 298 | struct gcpro gcpro1; |
| 300 | 299 | ||
| 301 | if (NILP(args)) | 300 | GCPRO1 (args); |
| 302 | return Qnil; | ||
| 303 | |||
| 304 | args_left = args; | ||
| 305 | GCPRO1 (args_left); | ||
| 306 | 301 | ||
| 307 | do | 302 | while (CONSP (args)) |
| 308 | { | 303 | { |
| 309 | val = Feval (Fcar (args_left)); | 304 | val = Feval (XCAR (args)); |
| 310 | if (!NILP (val)) | 305 | if (!NILP (val)) |
| 311 | break; | 306 | break; |
| 312 | args_left = Fcdr (args_left); | 307 | args = XCDR (args); |
| 313 | } | 308 | } |
| 314 | while (!NILP(args_left)); | ||
| 315 | 309 | ||
| 316 | UNGCPRO; | 310 | UNGCPRO; |
| 317 | return val; | 311 | return val; |
| @@ -325,24 +319,18 @@ usage: (and CONDITIONS ...) */) | |||
| 325 | (args) | 319 | (args) |
| 326 | Lisp_Object args; | 320 | Lisp_Object args; |
| 327 | { | 321 | { |
| 328 | register Lisp_Object val; | 322 | register Lisp_Object val = Qt; |
| 329 | Lisp_Object args_left; | ||
| 330 | struct gcpro gcpro1; | 323 | struct gcpro gcpro1; |
| 331 | 324 | ||
| 332 | if (NILP(args)) | 325 | GCPRO1 (args); |
| 333 | return Qt; | ||
| 334 | |||
| 335 | args_left = args; | ||
| 336 | GCPRO1 (args_left); | ||
| 337 | 326 | ||
| 338 | do | 327 | while (CONSP (args)) |
| 339 | { | 328 | { |
| 340 | val = Feval (Fcar (args_left)); | 329 | val = Feval (XCAR (args)); |
| 341 | if (NILP (val)) | 330 | if (NILP (val)) |
| 342 | break; | 331 | break; |
| 343 | args_left = Fcdr (args_left); | 332 | args = XCDR (args); |
| 344 | } | 333 | } |
| 345 | while (!NILP(args_left)); | ||
| 346 | 334 | ||
| 347 | UNGCPRO; | 335 | UNGCPRO; |
| 348 | return val; | 336 | return val; |
| @@ -410,22 +398,16 @@ usage: (progn BODY ...) */) | |||
| 410 | (args) | 398 | (args) |
| 411 | Lisp_Object args; | 399 | Lisp_Object args; |
| 412 | { | 400 | { |
| 413 | register Lisp_Object val; | 401 | register Lisp_Object val = Qnil; |
| 414 | Lisp_Object args_left; | ||
| 415 | struct gcpro gcpro1; | 402 | struct gcpro gcpro1; |
| 416 | 403 | ||
| 417 | if (NILP(args)) | 404 | GCPRO1 (args); |
| 418 | return Qnil; | ||
| 419 | |||
| 420 | args_left = args; | ||
| 421 | GCPRO1 (args_left); | ||
| 422 | 405 | ||
| 423 | do | 406 | while (CONSP (args)) |
| 424 | { | 407 | { |
| 425 | val = Feval (Fcar (args_left)); | 408 | val = Feval (XCAR (args)); |
| 426 | args_left = Fcdr (args_left); | 409 | args = XCDR (args); |
| 427 | } | 410 | } |
| 428 | while (!NILP(args_left)); | ||
| 429 | 411 | ||
| 430 | UNGCPRO; | 412 | UNGCPRO; |
| 431 | return val; | 413 | return val; |
| @@ -662,7 +644,7 @@ The elements can look like this: | |||
| 662 | (indent INDENT) | 644 | (indent INDENT) |
| 663 | Set NAME's `lisp-indent-function' property to INDENT. | 645 | Set NAME's `lisp-indent-function' property to INDENT. |
| 664 | 646 | ||
| 665 | (edebug DEBUG) | 647 | (debug DEBUG) |
| 666 | Set NAME's `edebug-form-spec' property to DEBUG. (This is | 648 | Set NAME's `edebug-form-spec' property to DEBUG. (This is |
| 667 | equivalent to writing a `def-edebug-spec' for the macro.) | 649 | equivalent to writing a `def-edebug-spec' for the macro.) |
| 668 | usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) | 650 | usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) |
| @@ -680,8 +662,8 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) | |||
| 680 | doc = Qnil; | 662 | doc = Qnil; |
| 681 | if (STRINGP (Fcar (tail))) | 663 | if (STRINGP (Fcar (tail))) |
| 682 | { | 664 | { |
| 683 | doc = Fcar (tail); | 665 | doc = XCAR (tail); |
| 684 | tail = Fcdr (tail); | 666 | tail = XCDR (tail); |
| 685 | } | 667 | } |
| 686 | 668 | ||
| 687 | while (CONSP (Fcar (tail)) | 669 | while (CONSP (Fcar (tail)) |
| @@ -775,9 +757,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 775 | if (NILP (tem)) | 757 | if (NILP (tem)) |
| 776 | Fset_default (sym, Feval (Fcar (tail))); | 758 | Fset_default (sym, Feval (Fcar (tail))); |
| 777 | tail = Fcdr (tail); | 759 | tail = Fcdr (tail); |
| 778 | if (!NILP (Fcar (tail))) | 760 | tem = Fcar (tail); |
| 761 | if (!NILP (tem)) | ||
| 779 | { | 762 | { |
| 780 | tem = Fcar (tail); | ||
| 781 | if (!NILP (Vpurify_flag)) | 763 | if (!NILP (Vpurify_flag)) |
| 782 | tem = Fpurecopy (tem); | 764 | tem = Fpurecopy (tem); |
| 783 | Fput (sym, Qvariable_documentation, tem); | 765 | Fput (sym, Qvariable_documentation, tem); |
| @@ -1897,14 +1879,14 @@ un_autoload (oldqueue) | |||
| 1897 | Vautoload_queue = oldqueue; | 1879 | Vautoload_queue = oldqueue; |
| 1898 | while (CONSP (queue)) | 1880 | while (CONSP (queue)) |
| 1899 | { | 1881 | { |
| 1900 | first = Fcar (queue); | 1882 | first = XCAR (queue); |
| 1901 | second = Fcdr (first); | 1883 | second = Fcdr (first); |
| 1902 | first = Fcar (first); | 1884 | first = Fcar (first); |
| 1903 | if (EQ (second, Qnil)) | 1885 | if (EQ (second, Qnil)) |
| 1904 | Vfeatures = first; | 1886 | Vfeatures = first; |
| 1905 | else | 1887 | else |
| 1906 | Ffset (first, second); | 1888 | Ffset (first, second); |
| 1907 | queue = Fcdr (queue); | 1889 | queue = XCDR (queue); |
| 1908 | } | 1890 | } |
| 1909 | return Qnil; | 1891 | return Qnil; |
| 1910 | } | 1892 | } |
| @@ -1943,7 +1925,7 @@ do_autoload (fundef, funname) | |||
| 1943 | queue = Vautoload_queue; | 1925 | queue = Vautoload_queue; |
| 1944 | while (CONSP (queue)) | 1926 | while (CONSP (queue)) |
| 1945 | { | 1927 | { |
| 1946 | first = Fcar (queue); | 1928 | first = XCAR (queue); |
| 1947 | second = Fcdr (first); | 1929 | second = Fcdr (first); |
| 1948 | first = Fcar (first); | 1930 | first = Fcar (first); |
| 1949 | 1931 | ||
| @@ -1951,9 +1933,9 @@ do_autoload (fundef, funname) | |||
| 1951 | may be an atom if the autoload entry was generated by a defalias | 1933 | may be an atom if the autoload entry was generated by a defalias |
| 1952 | or fset. */ | 1934 | or fset. */ |
| 1953 | if (CONSP (second)) | 1935 | if (CONSP (second)) |
| 1954 | Fput (first, Qautoload, (Fcdr (second))); | 1936 | Fput (first, Qautoload, (XCDR (second))); |
| 1955 | 1937 | ||
| 1956 | queue = Fcdr (queue); | 1938 | queue = XCDR (queue); |
| 1957 | } | 1939 | } |
| 1958 | 1940 | ||
| 1959 | /* Once loading finishes, don't undo it. */ | 1941 | /* Once loading finishes, don't undo it. */ |
| @@ -2179,7 +2161,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2179 | register Lisp_Object spread_arg; | 2161 | register Lisp_Object spread_arg; |
| 2180 | register Lisp_Object *funcall_args; | 2162 | register Lisp_Object *funcall_args; |
| 2181 | Lisp_Object fun; | 2163 | Lisp_Object fun; |
| 2182 | struct gcpro gcpro1; | 2164 | int nvars; |
| 2183 | 2165 | ||
| 2184 | fun = args [0]; | 2166 | fun = args [0]; |
| 2185 | funcall_args = 0; | 2167 | funcall_args = 0; |
| @@ -2219,8 +2201,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2219 | * sizeof (Lisp_Object)); | 2201 | * sizeof (Lisp_Object)); |
| 2220 | for (i = numargs; i < XSUBR (fun)->max_args;) | 2202 | for (i = numargs; i < XSUBR (fun)->max_args;) |
| 2221 | funcall_args[++i] = Qnil; | 2203 | funcall_args[++i] = Qnil; |
| 2222 | GCPRO1 (*funcall_args); | 2204 | nvars = 1 + XSUBR (fun)->max_args; |
| 2223 | gcpro1.nvars = 1 + XSUBR (fun)->max_args; | ||
| 2224 | } | 2205 | } |
| 2225 | } | 2206 | } |
| 2226 | funcall: | 2207 | funcall: |
| @@ -2230,8 +2211,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2230 | { | 2211 | { |
| 2231 | funcall_args = (Lisp_Object *) alloca ((1 + numargs) | 2212 | funcall_args = (Lisp_Object *) alloca ((1 + numargs) |
| 2232 | * sizeof (Lisp_Object)); | 2213 | * sizeof (Lisp_Object)); |
| 2233 | GCPRO1 (*funcall_args); | 2214 | nvars = 1 + numargs; |
| 2234 | gcpro1.nvars = 1 + numargs; | ||
| 2235 | } | 2215 | } |
| 2236 | 2216 | ||
| 2237 | bcopy (args, funcall_args, nargs * sizeof (Lisp_Object)); | 2217 | bcopy (args, funcall_args, nargs * sizeof (Lisp_Object)); |
| @@ -2244,7 +2224,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2244 | spread_arg = XCDR (spread_arg); | 2224 | spread_arg = XCDR (spread_arg); |
| 2245 | } | 2225 | } |
| 2246 | 2226 | ||
| 2247 | RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); | 2227 | return Ffuncall (nvars, funcall_args); |
| 2248 | } | 2228 | } |
| 2249 | 2229 | ||
| 2250 | /* Run hook variables in various ways. */ | 2230 | /* Run hook variables in various ways. */ |