comparison libiberty/obstacks.texi @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents a06113de4d67
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 @node Obstacks,Licenses,Functions,Top 1 @node Obstacks
2 @chapter Obstacks 2 @subsection Obstacks
3 @cindex obstacks 3 @cindex obstacks
4 4
5 An @dfn{obstack} is a pool of memory containing a stack of objects. You 5 An @dfn{obstack} is a pool of memory containing a stack of objects. You
6 can create any number of separate obstacks, and then allocate objects in 6 can create any number of separate obstacks, and then allocate objects in
7 specified obstacks. Within each obstack, the last object allocated must 7 specified obstacks. Within each obstack, the last object allocated must
13 are implemented with macros, so allocation is usually very fast as long as 13 are implemented with macros, so allocation is usually very fast as long as
14 the objects are usually small. And the only space overhead per object is 14 the objects are usually small. And the only space overhead per object is
15 the padding needed to start each object on a suitable boundary. 15 the padding needed to start each object on a suitable boundary.
16 16
17 @menu 17 @menu
18 * Creating Obstacks:: How to declare an obstack in your program. 18 * Creating Obstacks:: How to declare an obstack in your program.
19 * Preparing for Obstacks:: Preparations needed before you can 19 * Preparing for Obstacks:: Preparations needed before you can
20 use obstacks. 20 use obstacks.
21 * Allocation in an Obstack:: Allocating objects in an obstack. 21 * Allocation in an Obstack:: Allocating objects in an obstack.
22 * Freeing Obstack Objects:: Freeing objects in an obstack. 22 * Freeing Obstack Objects:: Freeing objects in an obstack.
23 * Obstack Functions:: The obstack functions are both 23 * Obstack Functions:: The obstack functions are really macros.
24 functions and macros.
25 * Growing Objects:: Making an object bigger by stages. 24 * Growing Objects:: Making an object bigger by stages.
26 * Extra Fast Growing:: Extra-high-efficiency (though more 25 * Extra Fast Growing:: Extra-high-efficiency (though more
27 complicated) growing objects. 26 complicated) growing objects.
28 * Status of an Obstack:: Inquiries about the status of an obstack. 27 * Status of an Obstack:: Inquiries about the status of an obstack.
29 * Obstacks Data Alignment:: Controlling alignment of objects in obstacks. 28 * Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
30 * Obstack Chunks:: How obstacks obtain and release chunks; 29 * Obstack Chunks:: How obstacks obtain and release chunks;
31 efficiency considerations. 30 efficiency considerations.
32 * Summary of Obstacks:: 31 * Summary of Obstacks::
33 @end menu 32 @end menu
34 33
35 @node Creating Obstacks 34 @node Creating Obstacks
36 @section Creating Obstacks 35 @subsubsection Creating Obstacks
37 36
38 The utilities for manipulating obstacks are declared in the header 37 The utilities for manipulating obstacks are declared in the header
39 file @file{obstack.h}. 38 file @file{obstack.h}.
40 @pindex obstack.h 39 @pindex obstack.h
41 40
44 @deftp {Data Type} {struct obstack} 43 @deftp {Data Type} {struct obstack}
45 An obstack is represented by a data structure of type @code{struct 44 An obstack is represented by a data structure of type @code{struct
46 obstack}. This structure has a small fixed size; it records the status 45 obstack}. This structure has a small fixed size; it records the status
47 of the obstack and how to find the space in which objects are allocated. 46 of the obstack and how to find the space in which objects are allocated.
48 It does not contain any of the objects themselves. You should not try 47 It does not contain any of the objects themselves. You should not try
49 to access the contents of the structure directly; use only the functions 48 to access the contents of the structure directly; use only the macros
50 described in this chapter. 49 described in this chapter.
51 @end deftp 50 @end deftp
52 51
53 You can declare variables of type @code{struct obstack} and use them as 52 You can declare variables of type @code{struct obstack} and use them as
54 obstacks, or you can allocate obstacks dynamically like any other kind 53 obstacks, or you can allocate obstacks dynamically like any other kind
55 of object. Dynamic allocation of obstacks allows your program to have a 54 of object. Dynamic allocation of obstacks allows your program to have a
56 variable number of different stacks. (You can even allocate an 55 variable number of different stacks. (You can even allocate an
57 obstack structure in another obstack, but this is rarely useful.) 56 obstack structure in another obstack, but this is rarely useful.)
58 57
59 All the functions that work with obstacks require you to specify which 58 All the macros that work with obstacks require you to specify which
60 obstack to use. You do this with a pointer of type @code{struct obstack 59 obstack to use. You do this with a pointer of type @code{struct obstack
61 *}. In the following, we often say ``an obstack'' when strictly 60 *}. In the following, we often say ``an obstack'' when strictly
62 speaking the object at hand is such a pointer. 61 speaking the object at hand is such a pointer.
63 62
64 The objects in the obstack are packed into large blocks called 63 The objects in the obstack are packed into large blocks called
72 get a chunk. Usually you supply a function which uses @code{malloc} 71 get a chunk. Usually you supply a function which uses @code{malloc}
73 directly or indirectly. You must also supply a function to free a chunk. 72 directly or indirectly. You must also supply a function to free a chunk.
74 These matters are described in the following section. 73 These matters are described in the following section.
75 74
76 @node Preparing for Obstacks 75 @node Preparing for Obstacks
77 @section Preparing for Using Obstacks 76 @subsubsection Preparing for Using Obstacks
78 77
79 Each source file in which you plan to use the obstack functions 78 Each source file in which you plan to use obstacks
80 must include the header file @file{obstack.h}, like this: 79 must include the header file @file{obstack.h}, like this:
81 80
82 @smallexample 81 @smallexample
83 #include <obstack.h> 82 #include <obstack.h>
84 @end smallexample 83 @end smallexample
85 84
86 @findex obstack_chunk_alloc 85 @findex obstack_chunk_alloc
87 @findex obstack_chunk_free 86 @findex obstack_chunk_free
88 Also, if the source file uses the macro @code{obstack_init}, it must 87 Also, if the source file uses the macro @code{obstack_init}, it must
89 declare or define two functions or macros that will be called by the 88 declare or define two macros that will be called by the
90 obstack library. One, @code{obstack_chunk_alloc}, is used to allocate 89 obstack library. One, @code{obstack_chunk_alloc}, is used to allocate
91 the chunks of memory into which objects are packed. The other, 90 the chunks of memory into which objects are packed. The other,
92 @code{obstack_chunk_free}, is used to return chunks when the objects in 91 @code{obstack_chunk_free}, is used to return chunks when the objects in
93 them are freed. These macros should appear before any use of obstacks 92 them are freed. These macros should appear before any use of obstacks
94 in the source file. 93 in the source file.
107 using obstacks is faster because @code{malloc} is called less often, for 106 using obstacks is faster because @code{malloc} is called less often, for
108 larger blocks of memory. @xref{Obstack Chunks}, for full details. 107 larger blocks of memory. @xref{Obstack Chunks}, for full details.
109 108
110 At run time, before the program can use a @code{struct obstack} object 109 At run time, before the program can use a @code{struct obstack} object
111 as an obstack, it must initialize the obstack by calling 110 as an obstack, it must initialize the obstack by calling
112 @code{obstack_init}. 111 @code{obstack_init} or one of its variants, @code{obstack_begin},
112 @code{obstack_specify_allocation}, or
113 @code{obstack_specify_allocation_with_arg}.
113 114
114 @comment obstack.h 115 @comment obstack.h
115 @comment GNU 116 @comment GNU
116 @deftypefun int obstack_init (struct obstack *@var{obstack-ptr}) 117 @deftypefun int obstack_init (struct obstack *@var{obstack-ptr})
117 Initialize obstack @var{obstack-ptr} for allocation of objects. This 118 Initialize obstack @var{obstack-ptr} for allocation of objects. This
118 function calls the obstack's @code{obstack_chunk_alloc} function. If 119 macro calls the obstack's @code{obstack_chunk_alloc} function. If
119 allocation of memory fails, the function pointed to by 120 allocation of memory fails, the function pointed to by
120 @code{obstack_alloc_failed_handler} is called. The @code{obstack_init} 121 @code{obstack_alloc_failed_handler} is called. The @code{obstack_init}
121 function always returns 1 (Compatibility notice: Former versions of 122 macro always returns 1 (Compatibility notice: Former versions of
122 obstack returned 0 if allocation failed). 123 obstack returned 0 if allocation failed).
123 @end deftypefun 124 @end deftypefun
124 125
125 Here are two examples of how to allocate the space for an obstack and 126 Here are two examples of how to allocate the space for an obstack and
126 initialize it. First, an obstack that is a static variable: 127 initialize it. First, an obstack that is a static variable:
138 struct obstack *myobstack_ptr 139 struct obstack *myobstack_ptr
139 = (struct obstack *) xmalloc (sizeof (struct obstack)); 140 = (struct obstack *) xmalloc (sizeof (struct obstack));
140 141
141 obstack_init (myobstack_ptr); 142 obstack_init (myobstack_ptr);
142 @end smallexample 143 @end smallexample
144
145 @comment obstack.h
146 @comment GNU
147 @deftypefun int obstack_begin (struct obstack *@var{obstack-ptr}, size_t chunk_size)
148 Like @code{obstack_init}, but specify chunks to be at least
149 @var{chunk_size} bytes in size.
150 @end deftypefun
151
152 @comment obstack.h
153 @comment GNU
154 @deftypefun int obstack_specify_allocation (struct obstack *@var{obstack-ptr}, size_t chunk_size, size_t alignment, void *(*chunkfun) (size_t), void (*freefun) (void *))
155 Like @code{obstack_init}, specifying chunk size, chunk
156 alignment, and memory allocation functions. A @var{chunk_size} or
157 @var{alignment} of zero results in the default size or alignment
158 respectively being used.
159 @end deftypefun
160
161 @comment obstack.h
162 @comment GNU
163 @deftypefun int obstack_specify_allocation_with_arg (struct obstack *@var{obstack-ptr}, size_t chunk_size, size_t alignment, void *(*chunkfun) (void *, size_t), void (*freefun) (void *, void *), void *arg)
164 Like @code{obstack_specify_allocation}, but specifying memory
165 allocation functions that take an extra first argument, @var{arg}.
166 @end deftypefun
143 167
144 @comment obstack.h 168 @comment obstack.h
145 @comment GNU 169 @comment GNU
146 @defvar obstack_alloc_failed_handler 170 @defvar obstack_alloc_failed_handler
147 The value of this variable is a pointer to a function that 171 The value of this variable is a pointer to a function that
158 @end smallexample 182 @end smallexample
159 183
160 @end defvar 184 @end defvar
161 185
162 @node Allocation in an Obstack 186 @node Allocation in an Obstack
163 @section Allocation in an Obstack 187 @subsubsection Allocation in an Obstack
164 @cindex allocation (obstacks) 188 @cindex allocation (obstacks)
165 189
166 The most direct way to allocate an object in an obstack is with 190 The most direct way to allocate an object in an obstack is with
167 @code{obstack_alloc}, which is invoked almost like @code{malloc}. 191 @code{obstack_alloc}, which is invoked almost like @code{malloc}.
168 192
169 @comment obstack.h 193 @comment obstack.h
170 @comment GNU 194 @comment GNU
171 @deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size}) 195 @deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, size_t @var{size})
172 This allocates an uninitialized block of @var{size} bytes in an obstack 196 This allocates an uninitialized block of @var{size} bytes in an obstack
173 and returns its address. Here @var{obstack-ptr} specifies which obstack 197 and returns its address. Here @var{obstack-ptr} specifies which obstack
174 to allocate the block in; it is the address of the @code{struct obstack} 198 to allocate the block in; it is the address of the @code{struct obstack}
175 object which represents the obstack. Each obstack function or macro 199 object which represents the obstack. Each obstack macro
176 requires you to specify an @var{obstack-ptr} as the first argument. 200 requires you to specify an @var{obstack-ptr} as the first argument.
177 201
178 This function calls the obstack's @code{obstack_chunk_alloc} function if 202 This macro calls the obstack's @code{obstack_chunk_alloc} function if
179 it needs to allocate a new chunk of memory; it calls 203 it needs to allocate a new chunk of memory; it calls
180 @code{obstack_alloc_failed_handler} if allocation of memory by 204 @code{obstack_alloc_failed_handler} if allocation of memory by
181 @code{obstack_chunk_alloc} failed. 205 @code{obstack_chunk_alloc} failed.
182 @end deftypefun 206 @end deftypefun
183 207
195 memcpy (s, string, len); 219 memcpy (s, string, len);
196 return s; 220 return s;
197 @} 221 @}
198 @end smallexample 222 @end smallexample
199 223
200 To allocate a block with specified contents, use the function 224 To allocate a block with specified contents, use the macro @code{obstack_copy}.
201 @code{obstack_copy}, declared like this: 225
202 226 @comment obstack.h
203 @comment obstack.h 227 @comment GNU
204 @comment GNU 228 @deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size})
205 @deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
206 This allocates a block and initializes it by copying @var{size} 229 This allocates a block and initializes it by copying @var{size}
207 bytes of data starting at @var{address}. It calls 230 bytes of data starting at @var{address}. It calls
208 @code{obstack_alloc_failed_handler} if allocation of memory by 231 @code{obstack_alloc_failed_handler} if allocation of memory by
209 @code{obstack_chunk_alloc} failed. 232 @code{obstack_chunk_alloc} failed.
210 @end deftypefun 233 @end deftypefun
211 234
212 @comment obstack.h 235 @comment obstack.h
213 @comment GNU 236 @comment GNU
214 @deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) 237 @deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size})
215 Like @code{obstack_copy}, but appends an extra byte containing a null 238 Like @code{obstack_copy}, but appends an extra byte containing a null
216 character. This extra byte is not counted in the argument @var{size}. 239 character. This extra byte is not counted in the argument @var{size}.
217 @end deftypefun 240 @end deftypefun
218 241
219 The @code{obstack_copy0} function is convenient for copying a sequence 242 The @code{obstack_copy0} macro is convenient for copying a sequence
220 of characters into an obstack as a null-terminated string. Here is an 243 of characters into an obstack as a null-terminated string. Here is an
221 example of its use: 244 example of its use:
222 245
223 @smallexample 246 @smallexample
224 char * 247 char *
225 obstack_savestring (char *addr, int size) 248 obstack_savestring (char *addr, size_t size)
226 @{ 249 @{
227 return obstack_copy0 (&myobstack, addr, size); 250 return obstack_copy0 (&myobstack, addr, size);
228 @} 251 @}
229 @end smallexample 252 @end smallexample
230 253
231 @noindent 254 @noindent
232 Contrast this with the previous example of @code{savestring} using 255 Contrast this with the previous example of @code{savestring} using
233 @code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}). 256 @code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}).
234 257
235 @node Freeing Obstack Objects 258 @node Freeing Obstack Objects
236 @section Freeing Objects in an Obstack 259 @subsubsection Freeing Objects in an Obstack
237 @cindex freeing (obstacks) 260 @cindex freeing (obstacks)
238 261
239 To free an object allocated in an obstack, use the function 262 To free an object allocated in an obstack, use the macro
240 @code{obstack_free}. Since the obstack is a stack of objects, freeing 263 @code{obstack_free}. Since the obstack is a stack of objects, freeing
241 one object automatically frees all other objects allocated more recently 264 one object automatically frees all other objects allocated more recently
242 in the same obstack. 265 in the same obstack.
243 266
244 @comment obstack.h 267 @comment obstack.h
263 the objects in a chunk become free, the obstack library automatically 286 the objects in a chunk become free, the obstack library automatically
264 frees the chunk (@pxref{Preparing for Obstacks}). Then other 287 frees the chunk (@pxref{Preparing for Obstacks}). Then other
265 obstacks, or non-obstack allocation, can reuse the space of the chunk. 288 obstacks, or non-obstack allocation, can reuse the space of the chunk.
266 289
267 @node Obstack Functions 290 @node Obstack Functions
268 @section Obstack Functions and Macros 291 @subsubsection Obstack Functions and Macros
269 @cindex macros 292 @cindex macros
270 293
271 The interfaces for using obstacks may be defined either as functions or 294 The interfaces for using obstacks are shown here as functions to
272 as macros, depending on the compiler. The obstack facility works with 295 specify the return type and argument types, but they are really
273 all C compilers, including both @w{ISO C} and traditional C, but there are 296 defined as macros. This means that the arguments don't actually have
274 precautions you must take if you plan to use compilers other than GNU C. 297 types, but they generally behave as if they have the types shown.
275 298 You can call these macros like functions, but you cannot use them in
276 If you are using an old-fashioned @w{non-ISO C} compiler, all the obstack 299 any other way (for example, you cannot take their address).
277 ``functions'' are actually defined only as macros. You can call these
278 macros like functions, but you cannot use them in any other way (for
279 example, you cannot take their address).
280 300
281 Calling the macros requires a special precaution: namely, the first 301 Calling the macros requires a special precaution: namely, the first
282 operand (the obstack pointer) may not contain any side effects, because 302 operand (the obstack pointer) may not contain any side effects, because
283 it may be computed more than once. For example, if you write this: 303 it may be computed more than once. For example, if you write this:
284 304
290 you will find that @code{get_obstack} may be called several times. 310 you will find that @code{get_obstack} may be called several times.
291 If you use @code{*obstack_list_ptr++} as the obstack pointer argument, 311 If you use @code{*obstack_list_ptr++} as the obstack pointer argument,
292 you will get very strange results since the incrementation may occur 312 you will get very strange results since the incrementation may occur
293 several times. 313 several times.
294 314
295 In @w{ISO C}, each function has both a macro definition and a function
296 definition. The function definition is used if you take the address of the
297 function without calling it. An ordinary call uses the macro definition by
298 default, but you can request the function definition instead by writing the
299 function name in parentheses, as shown here:
300
301 @smallexample
302 char *x;
303 void *(*funcp) ();
304 /* @r{Use the macro}. */
305 x = (char *) obstack_alloc (obptr, size);
306 /* @r{Call the function}. */
307 x = (char *) (obstack_alloc) (obptr, size);
308 /* @r{Take the address of the function}. */
309 funcp = obstack_alloc;
310 @end smallexample
311
312 @noindent
313 This is the same situation that exists in @w{ISO C} for the standard library
314 functions. @xref{Macro Definitions, , , libc, The GNU C Library Reference Manual}.
315
316 @strong{Warning:} When you do use the macros, you must observe the
317 precaution of avoiding side effects in the first operand, even in @w{ISO C}.
318
319 If you use the GNU C compiler, this precaution is not necessary, because 315 If you use the GNU C compiler, this precaution is not necessary, because
320 various language extensions in GNU C permit defining the macros so as to 316 various language extensions in GNU C permit defining the macros so as to
321 compute each argument only once. 317 compute each argument only once.
322 318
319 Note that arguments other than the first will only be evaluated once,
320 even when not using GNU C.
321
322 @code{obstack.h} does declare a number of functions,
323 @code{_obstack_begin}, @code{_obstack_begin_1},
324 @code{_obstack_newchunk}, @code{_obstack_free}, and
325 @code{_obstack_memory_used}. You should not call these directly.
326
323 @node Growing Objects 327 @node Growing Objects
324 @section Growing Objects 328 @subsubsection Growing Objects
325 @cindex growing objects (in obstacks) 329 @cindex growing objects (in obstacks)
326 @cindex changing the size of a block (obstacks) 330 @cindex changing the size of a block (obstacks)
327 331
328 Because memory in obstack chunks is used sequentially, it is possible to 332 Because memory in obstack chunks is used sequentially, it is possible to
329 build up an object step by step, adding one or more bytes at a time to the 333 build up an object step by step, adding one or more bytes at a time to the
330 end of the object. With this technique, you do not need to know how much 334 end of the object. With this technique, you do not need to know how much
331 data you will put in the object until you come to the end of it. We call 335 data you will put in the object until you come to the end of it. We call
332 this the technique of @dfn{growing objects}. The special functions 336 this the technique of @dfn{growing objects}. The special macros
333 for adding data to the growing object are described in this section. 337 for adding data to the growing object are described in this section.
334 338
335 You don't need to do anything special when you start to grow an object. 339 You don't need to do anything special when you start to grow an object.
336 Using one of the functions to add data to the object automatically 340 Using one of the macros to add data to the object automatically
337 starts it. However, it is necessary to say explicitly when the object is 341 starts it. However, it is necessary to say explicitly when the object is
338 finished. This is done with the function @code{obstack_finish}. 342 finished. This is done with @code{obstack_finish}.
339 343
340 The actual address of the object thus built up is not known until the 344 The actual address of the object thus built up is not known until the
341 object is finished. Until then, it always remains possible that you will 345 object is finished. Until then, it always remains possible that you will
342 add so much data that the object must be copied into a new chunk. 346 add so much data that the object must be copied into a new chunk.
343 347
345 ordinary allocation of another object. If you try to do so, the space 349 ordinary allocation of another object. If you try to do so, the space
346 already added to the growing object will become part of the other object. 350 already added to the growing object will become part of the other object.
347 351
348 @comment obstack.h 352 @comment obstack.h
349 @comment GNU 353 @comment GNU
350 @deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size}) 354 @deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, size_t @var{size})
351 The most basic function for adding to a growing object is 355 The most basic macro for adding to a growing object is
352 @code{obstack_blank}, which adds space without initializing it. 356 @code{obstack_blank}, which adds space without initializing it.
353 @end deftypefun 357 @end deftypefun
354 358
355 @comment obstack.h 359 @comment obstack.h
356 @comment GNU 360 @comment GNU
357 @deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size}) 361 @deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, size_t @var{size})
358 To add a block of initialized space, use @code{obstack_grow}, which is 362 To add a block of initialized space, use @code{obstack_grow}, which is
359 the growing-object analogue of @code{obstack_copy}. It adds @var{size} 363 the growing-object analogue of @code{obstack_copy}. It adds @var{size}
360 bytes of data to the growing object, copying the contents from 364 bytes of data to the growing object, copying the contents from
361 @var{data}. 365 @var{data}.
362 @end deftypefun 366 @end deftypefun
363 367
364 @comment obstack.h 368 @comment obstack.h
365 @comment GNU 369 @comment GNU
366 @deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size}) 370 @deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, size_t @var{size})
367 This is the growing-object analogue of @code{obstack_copy0}. It adds 371 This is the growing-object analogue of @code{obstack_copy0}. It adds
368 @var{size} bytes copied from @var{data}, followed by an additional null 372 @var{size} bytes copied from @var{data}, followed by an additional null
369 character. 373 character.
370 @end deftypefun 374 @end deftypefun
371 375
372 @comment obstack.h 376 @comment obstack.h
373 @comment GNU 377 @comment GNU
374 @deftypefun void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{c}) 378 @deftypefun void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{c})
375 To add one character at a time, use the function @code{obstack_1grow}. 379 To add one character at a time, use @code{obstack_1grow}.
376 It adds a single byte containing @var{c} to the growing object. 380 It adds a single byte containing @var{c} to the growing object.
377 @end deftypefun 381 @end deftypefun
378 382
379 @comment obstack.h 383 @comment obstack.h
380 @comment GNU 384 @comment GNU
381 @deftypefun void obstack_ptr_grow (struct obstack *@var{obstack-ptr}, void *@var{data}) 385 @deftypefun void obstack_ptr_grow (struct obstack *@var{obstack-ptr}, void *@var{data})
382 Adding the value of a pointer one can use the function 386 Adding the value of a pointer one can use
383 @code{obstack_ptr_grow}. It adds @code{sizeof (void *)} bytes 387 @code{obstack_ptr_grow}. It adds @code{sizeof (void *)} bytes
384 containing the value of @var{data}. 388 containing the value of @var{data}.
385 @end deftypefun 389 @end deftypefun
386 390
387 @comment obstack.h 391 @comment obstack.h
388 @comment GNU 392 @comment GNU
389 @deftypefun void obstack_int_grow (struct obstack *@var{obstack-ptr}, int @var{data}) 393 @deftypefun void obstack_int_grow (struct obstack *@var{obstack-ptr}, int @var{data})
390 A single value of type @code{int} can be added by using the 394 A single value of type @code{int} can be added by using
391 @code{obstack_int_grow} function. It adds @code{sizeof (int)} bytes to 395 @code{obstack_int_grow}. It adds @code{sizeof (int)} bytes to
392 the growing object and initializes them with the value of @var{data}. 396 the growing object and initializes them with the value of @var{data}.
393 @end deftypefun 397 @end deftypefun
394 398
395 @comment obstack.h 399 @comment obstack.h
396 @comment GNU 400 @comment GNU
397 @deftypefun {void *} obstack_finish (struct obstack *@var{obstack-ptr}) 401 @deftypefun {void *} obstack_finish (struct obstack *@var{obstack-ptr})
398 When you are finished growing the object, use the function 402 When you are finished growing the object, use
399 @code{obstack_finish} to close it off and return its final address. 403 @code{obstack_finish} to close it off and return its final address.
400 404
401 Once you have finished the object, the obstack is available for ordinary 405 Once you have finished the object, the obstack is available for ordinary
402 allocation or for growing another object. 406 allocation or for growing another object.
403
404 This function can return a null pointer under the same conditions as
405 @code{obstack_alloc} (@pxref{Allocation in an Obstack}).
406 @end deftypefun 407 @end deftypefun
407 408
408 When you build an object by growing it, you will probably need to know 409 When you build an object by growing it, you will probably need to know
409 afterward how long it became. You need not keep track of this as you grow 410 afterward how long it became. You need not keep track of this as you grow
410 the object, because you can find out the length from the obstack just 411 the object, because you can find out the length from the obstack
411 before finishing the object with the function @code{obstack_object_size}, 412 with @code{obstack_object_size}, before finishing the object.
412 declared as follows: 413
413 414 @comment obstack.h
414 @comment obstack.h 415 @comment GNU
415 @comment GNU 416 @deftypefun size_t obstack_object_size (struct obstack *@var{obstack-ptr})
416 @deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr}) 417 This macro returns the current size of the growing object, in bytes.
417 This function returns the current size of the growing object, in bytes. 418 Remember to call @code{obstack_object_size} @emph{before} finishing the object.
418 Remember to call this function @emph{before} finishing the object.
419 After it is finished, @code{obstack_object_size} will return zero. 419 After it is finished, @code{obstack_object_size} will return zero.
420 @end deftypefun 420 @end deftypefun
421 421
422 If you have started growing an object and wish to cancel it, you should 422 If you have started growing an object and wish to cancel it, you should
423 finish it and then free it, like this: 423 finish it and then free it, like this:
427 @end smallexample 427 @end smallexample
428 428
429 @noindent 429 @noindent
430 This has no effect if no object was growing. 430 This has no effect if no object was growing.
431 431
432 @cindex shrinking objects
433 You can use @code{obstack_blank} with a negative size argument to make
434 the current object smaller. Just don't try to shrink it beyond zero
435 length---there's no telling what will happen if you do that.
436
437 @node Extra Fast Growing 432 @node Extra Fast Growing
438 @section Extra Fast Growing Objects 433 @subsubsection Extra Fast Growing Objects
439 @cindex efficiency and obstacks 434 @cindex efficiency and obstacks
440 435
441 The usual functions for growing objects incur overhead for checking 436 The usual macros for growing objects incur overhead for checking
442 whether there is room for the new growth in the current chunk. If you 437 whether there is room for the new growth in the current chunk. If you
443 are frequently constructing objects in small steps of growth, this 438 are frequently constructing objects in small steps of growth, this
444 overhead can be significant. 439 overhead can be significant.
445 440
446 You can reduce the overhead by using special ``fast growth'' 441 You can reduce the overhead by using special ``fast growth''
447 functions that grow the object without checking. In order to have a 442 macros that grow the object without checking. In order to have a
448 robust program, you must do the checking yourself. If you do this checking 443 robust program, you must do the checking yourself. If you do this checking
449 in the simplest way each time you are about to add data to the object, you 444 in the simplest way each time you are about to add data to the object, you
450 have not saved anything, because that is what the ordinary growth 445 have not saved anything, because that is what the ordinary growth
451 functions do. But if you can arrange to check less often, or check 446 macros do. But if you can arrange to check less often, or check
452 more efficiently, then you make the program faster. 447 more efficiently, then you make the program faster.
453 448
454 The function @code{obstack_room} returns the amount of room available 449 @code{obstack_room} returns the amount of room available
455 in the current chunk. It is declared as follows: 450 in the current chunk.
456 451
457 @comment obstack.h 452 @comment obstack.h
458 @comment GNU 453 @comment GNU
459 @deftypefun int obstack_room (struct obstack *@var{obstack-ptr}) 454 @deftypefun size_t obstack_room (struct obstack *@var{obstack-ptr})
460 This returns the number of bytes that can be added safely to the current 455 This returns the number of bytes that can be added safely to the current
461 growing object (or to an object about to be started) in obstack 456 growing object (or to an object about to be started) in obstack
462 @var{obstack} using the fast growth functions. 457 @var{obstack} using the fast growth macros.
463 @end deftypefun 458 @end deftypefun
464 459
465 While you know there is room, you can use these fast growth functions 460 While you know there is room, you can use these fast growth macros
466 for adding data to a growing object: 461 for adding data to a growing object:
467 462
468 @comment obstack.h 463 @comment obstack.h
469 @comment GNU 464 @comment GNU
470 @deftypefun void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{c}) 465 @deftypefun void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{c})
471 The function @code{obstack_1grow_fast} adds one byte containing the 466 @code{obstack_1grow_fast} adds one byte containing the
472 character @var{c} to the growing object in obstack @var{obstack-ptr}. 467 character @var{c} to the growing object in obstack @var{obstack-ptr}.
473 @end deftypefun 468 @end deftypefun
474 469
475 @comment obstack.h 470 @comment obstack.h
476 @comment GNU 471 @comment GNU
477 @deftypefun void obstack_ptr_grow_fast (struct obstack *@var{obstack-ptr}, void *@var{data}) 472 @deftypefun void obstack_ptr_grow_fast (struct obstack *@var{obstack-ptr}, void *@var{data})
478 The function @code{obstack_ptr_grow_fast} adds @code{sizeof (void *)} 473 @code{obstack_ptr_grow_fast} adds @code{sizeof (void *)}
479 bytes containing the value of @var{data} to the growing object in 474 bytes containing the value of @var{data} to the growing object in
480 obstack @var{obstack-ptr}. 475 obstack @var{obstack-ptr}.
481 @end deftypefun 476 @end deftypefun
482 477
483 @comment obstack.h 478 @comment obstack.h
484 @comment GNU 479 @comment GNU
485 @deftypefun void obstack_int_grow_fast (struct obstack *@var{obstack-ptr}, int @var{data}) 480 @deftypefun void obstack_int_grow_fast (struct obstack *@var{obstack-ptr}, int @var{data})
486 The function @code{obstack_int_grow_fast} adds @code{sizeof (int)} bytes 481 @code{obstack_int_grow_fast} adds @code{sizeof (int)} bytes
487 containing the value of @var{data} to the growing object in obstack 482 containing the value of @var{data} to the growing object in obstack
488 @var{obstack-ptr}. 483 @var{obstack-ptr}.
489 @end deftypefun 484 @end deftypefun
490 485
491 @comment obstack.h 486 @comment obstack.h
492 @comment GNU 487 @comment GNU
493 @deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size}) 488 @deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, size_t @var{size})
494 The function @code{obstack_blank_fast} adds @var{size} bytes to the 489 @code{obstack_blank_fast} adds @var{size} bytes to the
495 growing object in obstack @var{obstack-ptr} without initializing them. 490 growing object in obstack @var{obstack-ptr} without initializing them.
496 @end deftypefun 491 @end deftypefun
497 492
498 When you check for space using @code{obstack_room} and there is not 493 When you check for space using @code{obstack_room} and there is not
499 enough room for what you want to add, the fast growth functions 494 enough room for what you want to add, the fast growth macros
500 are not safe. In this case, simply use the corresponding ordinary 495 are not safe. In this case, simply use the corresponding ordinary
501 growth function instead. Very soon this will copy the object to a 496 growth macro instead. Very soon this will copy the object to a
502 new chunk; then there will be lots of room available again. 497 new chunk; then there will be lots of room available again.
503 498
504 So, each time you use an ordinary growth function, check afterward for 499 So, each time you use an ordinary growth macro, check afterward for
505 sufficient space using @code{obstack_room}. Once the object is copied 500 sufficient space using @code{obstack_room}. Once the object is copied
506 to a new chunk, there will be plenty of space again, so the program will 501 to a new chunk, there will be plenty of space again, so the program will
507 start using the fast growth functions again. 502 start using the fast growth macros again.
508 503
509 Here is an example: 504 Here is an example:
510 505
511 @smallexample 506 @smallexample
512 @group 507 @group
513 void 508 void
514 add_string (struct obstack *obstack, const char *ptr, int len) 509 add_string (struct obstack *obstack, const char *ptr, size_t len)
515 @{ 510 @{
516 while (len > 0) 511 while (len > 0)
517 @{ 512 @{
518 int room = obstack_room (obstack); 513 size_t room = obstack_room (obstack);
519 if (room == 0) 514 if (room == 0)
520 @{ 515 @{
521 /* @r{Not enough room. Add one character slowly,} 516 /* @r{Not enough room. Add one character slowly,}
522 @r{which may copy to a new chunk and make room.} */ 517 @r{which may copy to a new chunk and make room.} */
523 obstack_1grow (obstack, *ptr++); 518 obstack_1grow (obstack, *ptr++);
524 len--; 519 len--;
525 @} 520 @}
526 else 521 else
535 @} 530 @}
536 @} 531 @}
537 @end group 532 @end group
538 @end smallexample 533 @end smallexample
539 534
535 @cindex shrinking objects
536 You can use @code{obstack_blank_fast} with a ``negative'' size
537 argument to make the current object smaller. Just don't try to shrink
538 it beyond zero length---there's no telling what will happen if you do
539 that. Earlier versions of obstacks allowed you to use
540 @code{obstack_blank} to shrink objects. This will no longer work.
541
540 @node Status of an Obstack 542 @node Status of an Obstack
541 @section Status of an Obstack 543 @subsubsection Status of an Obstack
542 @cindex obstack status 544 @cindex obstack status
543 @cindex status of obstack 545 @cindex status of obstack
544 546
545 Here are functions that provide information on the current status of 547 Here are macros that provide information on the current status of
546 allocation in an obstack. You can use them to learn about an object while 548 allocation in an obstack. You can use them to learn about an object while
547 still growing it. 549 still growing it.
548 550
549 @comment obstack.h 551 @comment obstack.h
550 @comment GNU 552 @comment GNU
551 @deftypefun {void *} obstack_base (struct obstack *@var{obstack-ptr}) 553 @deftypefun {void *} obstack_base (struct obstack *@var{obstack-ptr})
552 This function returns the tentative address of the beginning of the 554 This macro returns the tentative address of the beginning of the
553 currently growing object in @var{obstack-ptr}. If you finish the object 555 currently growing object in @var{obstack-ptr}. If you finish the object
554 immediately, it will have that address. If you make it larger first, it 556 immediately, it will have that address. If you make it larger first, it
555 may outgrow the current chunk---then its address will change! 557 may outgrow the current chunk---then its address will change!
556 558
557 If no object is growing, this value says where the next object you 559 If no object is growing, this value says where the next object you
560 @end deftypefun 562 @end deftypefun
561 563
562 @comment obstack.h 564 @comment obstack.h
563 @comment GNU 565 @comment GNU
564 @deftypefun {void *} obstack_next_free (struct obstack *@var{obstack-ptr}) 566 @deftypefun {void *} obstack_next_free (struct obstack *@var{obstack-ptr})
565 This function returns the address of the first free byte in the current 567 This macro returns the address of the first free byte in the current
566 chunk of obstack @var{obstack-ptr}. This is the end of the currently 568 chunk of obstack @var{obstack-ptr}. This is the end of the currently
567 growing object. If no object is growing, @code{obstack_next_free} 569 growing object. If no object is growing, @code{obstack_next_free}
568 returns the same value as @code{obstack_base}. 570 returns the same value as @code{obstack_base}.
569 @end deftypefun 571 @end deftypefun
570 572
571 @comment obstack.h 573 @comment obstack.h
572 @comment GNU 574 @comment GNU
573 @deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr}) 575 @deftypefun size_t obstack_object_size (struct obstack *@var{obstack-ptr})
574 This function returns the size in bytes of the currently growing object. 576 This macro returns the size in bytes of the currently growing object.
575 This is equivalent to 577 This is equivalent to
576 578
577 @smallexample 579 @smallexample
578 obstack_next_free (@var{obstack-ptr}) - obstack_base (@var{obstack-ptr}) 580 ((size_t) (obstack_next_free (@var{obstack-ptr}) - obstack_base (@var{obstack-ptr})))
579 @end smallexample 581 @end smallexample
580 @end deftypefun 582 @end deftypefun
581 583
582 @node Obstacks Data Alignment 584 @node Obstacks Data Alignment
583 @section Alignment of Data in Obstacks 585 @subsubsection Alignment of Data in Obstacks
584 @cindex alignment (in obstacks) 586 @cindex alignment (in obstacks)
585 587
586 Each obstack has an @dfn{alignment boundary}; each object allocated in 588 Each obstack has an @dfn{alignment boundary}; each object allocated in
587 the obstack automatically starts on an address that is a multiple of the 589 the obstack automatically starts on an address that is a multiple of the
588 specified boundary. By default, this boundary is 4 bytes. 590 specified boundary. By default, this boundary is aligned so that
591 the object can hold any type of data.
589 592
590 To access an obstack's alignment boundary, use the macro 593 To access an obstack's alignment boundary, use the macro
591 @code{obstack_alignment_mask}, whose function prototype looks like 594 @code{obstack_alignment_mask}.
592 this: 595
593 596 @comment obstack.h
594 @comment obstack.h 597 @comment GNU
595 @comment GNU 598 @deftypefn Macro size_t obstack_alignment_mask (struct obstack *@var{obstack-ptr})
596 @deftypefn Macro int obstack_alignment_mask (struct obstack *@var{obstack-ptr})
597 The value is a bit mask; a bit that is 1 indicates that the corresponding 599 The value is a bit mask; a bit that is 1 indicates that the corresponding
598 bit in the address of an object should be 0. The mask value should be one 600 bit in the address of an object should be 0. The mask value should be one
599 less than a power of 2; the effect is that all object addresses are 601 less than a power of 2; the effect is that all object addresses are
600 multiples of that power of 2. The default value of the mask is 3, so that 602 multiples of that power of 2. The default value of the mask is a value
603 that allows aligned objects to hold any type of data: for example, if
604 its value is 3, any type of data can be stored at locations whose
601 addresses are multiples of 4. A mask value of 0 means an object can start 605 addresses are multiples of 4. A mask value of 0 means an object can start
602 on any multiple of 1 (that is, no alignment is required). 606 on any multiple of 1 (that is, no alignment is required).
603 607
604 The expansion of the macro @code{obstack_alignment_mask} is an lvalue, 608 The expansion of the macro @code{obstack_alignment_mask} is an lvalue,
605 so you can alter the mask by assignment. For example, this statement: 609 so you can alter the mask by assignment. For example, this statement:
618 alignment mask take effect immediately by calling @code{obstack_finish}. 622 alignment mask take effect immediately by calling @code{obstack_finish}.
619 This will finish a zero-length object and then do proper alignment for 623 This will finish a zero-length object and then do proper alignment for
620 the next object. 624 the next object.
621 625
622 @node Obstack Chunks 626 @node Obstack Chunks
623 @section Obstack Chunks 627 @subsubsection Obstack Chunks
624 @cindex efficiency of chunks 628 @cindex efficiency of chunks
625 @cindex chunks 629 @cindex chunks
626 630
627 Obstacks work by allocating space for themselves in large chunks, and 631 Obstacks work by allocating space for themselves in large chunks, and
628 then parceling out space in the chunks to satisfy your requests. Chunks 632 then parceling out space in the chunks to satisfy your requests. Chunks
656 enough to satisfy many typical requests on the obstack yet short enough 660 enough to satisfy many typical requests on the obstack yet short enough
657 not to waste too much memory in the portion of the last chunk not yet used. 661 not to waste too much memory in the portion of the last chunk not yet used.
658 662
659 @comment obstack.h 663 @comment obstack.h
660 @comment GNU 664 @comment GNU
661 @deftypefn Macro int obstack_chunk_size (struct obstack *@var{obstack-ptr}) 665 @deftypefn Macro size_t obstack_chunk_size (struct obstack *@var{obstack-ptr})
662 This returns the chunk size of the given obstack. 666 This returns the chunk size of the given obstack.
663 @end deftypefn 667 @end deftypefn
664 668
665 Since this macro expands to an lvalue, you can specify a new chunk size by 669 Since this macro expands to an lvalue, you can specify a new chunk size by
666 assigning it a new value. Doing so does not affect the chunks already 670 assigning it a new value. Doing so does not affect the chunks already
674 if (obstack_chunk_size (obstack_ptr) < @var{new-chunk-size}) 678 if (obstack_chunk_size (obstack_ptr) < @var{new-chunk-size})
675 obstack_chunk_size (obstack_ptr) = @var{new-chunk-size}; 679 obstack_chunk_size (obstack_ptr) = @var{new-chunk-size};
676 @end smallexample 680 @end smallexample
677 681
678 @node Summary of Obstacks 682 @node Summary of Obstacks
679 @section Summary of Obstack Functions 683 @subsubsection Summary of Obstack Macros
680 684
681 Here is a summary of all the functions associated with obstacks. Each 685 Here is a summary of all the macros associated with obstacks. Each
682 takes the address of an obstack (@code{struct obstack *}) as its first 686 takes the address of an obstack (@code{struct obstack *}) as its first
683 argument. 687 argument.
684 688
685 @table @code 689 @table @code
686 @item void obstack_init (struct obstack *@var{obstack-ptr}) 690 @item int obstack_init (struct obstack *@var{obstack-ptr})
687 Initialize use of an obstack. @xref{Creating Obstacks}. 691 Initialize use of an obstack. @xref{Creating Obstacks}.
688 692
689 @item void *obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size}) 693 @item int obstack_begin (struct obstack *@var{obstack-ptr}, size_t chunk_size)
694 Initialize use of an obstack, with an initial chunk of
695 @var{chunk_size} bytes.
696
697 @item int obstack_specify_allocation (struct obstack *@var{obstack-ptr}, size_t chunk_size, size_t alignment, void *(*chunkfun) (size_t), void (*freefun) (void *))
698 Initialize use of an obstack, specifying intial chunk size, chunk
699 alignment, and memory allocation functions.
700
701 @item int obstack_specify_allocation_with_arg (struct obstack *@var{obstack-ptr}, size_t chunk_size, size_t alignment, void *(*chunkfun) (void *, size_t), void (*freefun) (void *, void *), void *arg)
702 Like @code{obstack_specify_allocation}, but specifying memory
703 allocation functions that take an extra first argument, @var{arg}.
704
705 @item void *obstack_alloc (struct obstack *@var{obstack-ptr}, size_t @var{size})
690 Allocate an object of @var{size} uninitialized bytes. 706 Allocate an object of @var{size} uninitialized bytes.
691 @xref{Allocation in an Obstack}. 707 @xref{Allocation in an Obstack}.
692 708
693 @item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) 709 @item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size})
694 Allocate an object of @var{size} bytes, with contents copied from 710 Allocate an object of @var{size} bytes, with contents copied from
695 @var{address}. @xref{Allocation in an Obstack}. 711 @var{address}. @xref{Allocation in an Obstack}.
696 712
697 @item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) 713 @item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size})
698 Allocate an object of @var{size}+1 bytes, with @var{size} of them copied 714 Allocate an object of @var{size}+1 bytes, with @var{size} of them copied
699 from @var{address}, followed by a null character at the end. 715 from @var{address}, followed by a null character at the end.
700 @xref{Allocation in an Obstack}. 716 @xref{Allocation in an Obstack}.
701 717
702 @item void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object}) 718 @item void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object})
703 Free @var{object} (and everything allocated in the specified obstack 719 Free @var{object} (and everything allocated in the specified obstack
704 more recently than @var{object}). @xref{Freeing Obstack Objects}. 720 more recently than @var{object}). @xref{Freeing Obstack Objects}.
705 721
706 @item void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size}) 722 @item void obstack_blank (struct obstack *@var{obstack-ptr}, size_t @var{size})
707 Add @var{size} uninitialized bytes to a growing object. 723 Add @var{size} uninitialized bytes to a growing object.
708 @xref{Growing Objects}. 724 @xref{Growing Objects}.
709 725
710 @item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) 726 @item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size})
711 Add @var{size} bytes, copied from @var{address}, to a growing object. 727 Add @var{size} bytes, copied from @var{address}, to a growing object.
712 @xref{Growing Objects}. 728 @xref{Growing Objects}.
713 729
714 @item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) 730 @item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size})
715 Add @var{size} bytes, copied from @var{address}, to a growing object, 731 Add @var{size} bytes, copied from @var{address}, to a growing object,
716 and then add another byte containing a null character. @xref{Growing 732 and then add another byte containing a null character. @xref{Growing
717 Objects}. 733 Objects}.
718 734
719 @item void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{data-char}) 735 @item void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{data-char})
722 738
723 @item void *obstack_finish (struct obstack *@var{obstack-ptr}) 739 @item void *obstack_finish (struct obstack *@var{obstack-ptr})
724 Finalize the object that is growing and return its permanent address. 740 Finalize the object that is growing and return its permanent address.
725 @xref{Growing Objects}. 741 @xref{Growing Objects}.
726 742
727 @item int obstack_object_size (struct obstack *@var{obstack-ptr}) 743 @item size_t obstack_object_size (struct obstack *@var{obstack-ptr})
728 Get the current size of the currently growing object. @xref{Growing 744 Get the current size of the currently growing object. @xref{Growing
729 Objects}. 745 Objects}.
730 746
731 @item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size}) 747 @item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, size_t @var{size})
732 Add @var{size} uninitialized bytes to a growing object without checking 748 Add @var{size} uninitialized bytes to a growing object without checking
733 that there is enough room. @xref{Extra Fast Growing}. 749 that there is enough room. @xref{Extra Fast Growing}.
734 750
735 @item void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{data-char}) 751 @item void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{data-char})
736 Add one byte containing @var{data-char} to a growing object without 752 Add one byte containing @var{data-char} to a growing object without
737 checking that there is enough room. @xref{Extra Fast Growing}. 753 checking that there is enough room. @xref{Extra Fast Growing}.
738 754
739 @item int obstack_room (struct obstack *@var{obstack-ptr}) 755 @item size_t obstack_room (struct obstack *@var{obstack-ptr})
740 Get the amount of room now available for growing the current object. 756 Get the amount of room now available for growing the current object.
741 @xref{Extra Fast Growing}. 757 @xref{Extra Fast Growing}.
742 758
743 @item int obstack_alignment_mask (struct obstack *@var{obstack-ptr}) 759 @item size_t obstack_alignment_mask (struct obstack *@var{obstack-ptr})
744 The mask used for aligning the beginning of an object. This is an 760 The mask used for aligning the beginning of an object. This is an
745 lvalue. @xref{Obstacks Data Alignment}. 761 lvalue. @xref{Obstacks Data Alignment}.
746 762
747 @item int obstack_chunk_size (struct obstack *@var{obstack-ptr}) 763 @item size_t obstack_chunk_size (struct obstack *@var{obstack-ptr})
748 The size for allocating chunks. This is an lvalue. @xref{Obstack Chunks}. 764 The size for allocating chunks. This is an lvalue. @xref{Obstack Chunks}.
749 765
750 @item void *obstack_base (struct obstack *@var{obstack-ptr}) 766 @item void *obstack_base (struct obstack *@var{obstack-ptr})
751 Tentative starting address of the currently growing object. 767 Tentative starting address of the currently growing object.
752 @xref{Status of an Obstack}. 768 @xref{Status of an Obstack}.