Mercurial > hg > xemacs-beta
annotate src/sunpro.c @ 5781:0853e1ec8529
Use alloca_{rawbytes,ibytes} in #'copy-file, #'insert-file-contents-internal
src/ChangeLog addition:
2014-01-20 Aidan Kehoe <kehoea@parhasard.net>
* fileio.c (Fcopy_file, Finsert_file_contents_internal):
Use alloca_{rawbytes,ibytes} here instead of the implicit alloca
on the stack; doesn't change where the buffers are allocated for
these two functions, but does mean that decisions about alloca
vs. malloc based on buffer size are made in the same place
(ultimately, the ALLOCA() macro).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 20 Jan 2014 17:53:07 +0000 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
428 | 1 /* Sunpro-specific routines. |
2 | |
3 Copyright (C) 1994 Sun Microsystems, Inc. | |
4 | |
5 This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4105
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
428 | 8 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4105
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4105
diff
changeset
|
10 option) any later version. |
428 | 11 |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4105
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 19 |
20 /* Synched up with: Not in FSF. */ | |
21 | |
4105 | 22 /* Commentary: |
23 | |
24 According to Paul Keusemann in <20070802140358.GA19566@visi.com>, this | |
25 feature probably still works as of 2007-08-02. However, that doesn't seem | |
26 reliable since there doesn't seem to be a way to configure it! */ | |
27 | |
428 | 28 #include <config.h> |
29 #include "lisp.h" | |
30 | |
31 /* #### | |
32 | |
33 The following junk used to be in lisp/prim/files.el. It obviously | |
34 doesn't belong there, but should go somewhere. | |
35 | |
36 (if (fboundp 'ut-log-text) ;; #### Sun stuff; what is this? | |
37 (ut-log-text "Reading a file.")) | |
38 */ | |
39 | |
40 /* Whether usage tracking is turned on (Sun only) */ | |
41 Lisp_Object Vusage_tracking; | |
42 #ifdef USAGE_TRACKING | |
43 #include <ut.h> | |
44 #endif | |
45 | |
46 DEFUN ("ut-log-text", Fut_log_text, 1, MANY, 0, /* | |
47 Log a usage-tracking message if `usage-tracking' is non-nil. | |
48 Args are the same as to `format'. Returns whether the message was | |
49 actually logged. If usage-tracking support was not compiled in, this | |
50 function has no effect and always returns `nil'. See function | |
51 `has-usage-tracking-p'. | |
52 */ | |
2286 | 53 #ifdef USAGE_TRACKING |
54 (int nargs, Lisp_Object *args) | |
55 #else | |
56 (int UNUSED (nargs), Lisp_Object *UNUSED (args)) | |
57 #endif | |
4105 | 58 ) |
428 | 59 { |
60 #ifdef USAGE_TRACKING | |
61 Lisp_Object xs; | |
771 | 62 unsigned char *s; |
428 | 63 |
64 if (!NILP (Vusage_tracking)) | |
65 { | |
66 xs = Fformat (nargs, args); | |
67 CHECK_STRING (xs); | |
68 s = XSTRING_DATA (xs); | |
69 ut_log_text ((char *) s); | |
70 } | |
71 return Vusage_tracking; | |
72 #else | |
73 return Qnil; | |
74 #endif | |
75 } | |
76 | |
77 | |
78 /************************************************************************/ | |
79 /* initialization */ | |
80 /************************************************************************/ | |
81 | |
82 void | |
83 syms_of_sunpro (void) | |
84 { | |
85 DEFSUBR (Fut_log_text); | |
86 } | |
87 | |
88 void | |
89 vars_of_sunpro (void) | |
90 { | |
91 DEFVAR_LISP ("usage-tracking", &Vusage_tracking /* | |
92 Whether usage tracking is turned on (Sun internal use only). | |
93 Has no effect if usage tracking support has not been compiled in. | |
94 */ ); | |
95 Vusage_tracking = Qnil; | |
96 | |
97 Fprovide (intern ("sparcworks")); | |
98 #ifdef USAGE_TRACKING | |
99 Fprovide (intern ("usage-tracking")); | |
100 #endif | |
101 } | |
102 | |
103 void | |
104 init_sunpro (void) | |
105 { | |
106 Vusage_tracking = Qnil; | |
107 #ifdef USAGE_TRACKING | |
108 if (!purify_flag) | |
109 { /* Enabled only when not dumping an executable */ | |
110 Vusage_tracking = Qt; | |
111 ut_initialize ("xemacs", NULL, NULL); | |
112 } | |
113 #endif | |
114 } |