~ubuntu-branches/ubuntu/quantal/arp-scan/quantal

« back to all changes in this revision

Viewing changes to obstack.c

  • Committer: Bazaar Package Importer
  • Author(s): William Vera
  • Date: 2011-07-04 19:37:30 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110704193730-r8fb49mpqqlaic1f
Tags: 1.8.1-1
* New upstream release (Closes: #543383).
* Added William Vera as Uploader.
* Added a debian/watch file.
* Added "Homepage" in debian/control.
* Added libwww-perl as Recommend depend (Closes: #630563).
* Fixed empty-directory usr/sbin/.
* Added a patch to fix hyphen-used-as-minus-sign.
* Updated debian/copyright
* Updated debhelper version (>= 8).
* Updated debian/compat to 8.
* Updated Standards Version to 3.9.2.
* Cleanup debian/rules.
   + distclean rule.
* Switch to dpkg-source 3.0 (quilt) format

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
   You should have received a copy of the GNU General Public License
19
19
   along with this program; if not, write to the Free Software
20
 
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
20
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
21
21
   USA.  */
22
22
 
23
23
#ifdef HAVE_CONFIG_H
52
52
#ifndef ELIDE_CODE
53
53
 
54
54
 
55
 
#if defined (__STDC__) && __STDC__
56
55
#define POINTER void *
57
 
#else
58
 
#define POINTER char *
59
 
#endif
60
56
 
61
57
/* Determine default alignment.  */
62
58
struct fooalign {char x; double d;};
81
77
   jump to the handler pointed to by `obstack_alloc_failed_handler'.
82
78
   This variable by default points to the internal function
83
79
   `print_and_abort'.  */
84
 
#if defined (__STDC__) && __STDC__
85
80
static void print_and_abort (void);
86
81
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
87
 
#else
88
 
static void print_and_abort ();
89
 
void (*obstack_alloc_failed_handler) () = print_and_abort;
90
 
#endif
91
82
 
92
83
/* Exit value used when `print_and_abort' is used.  */
93
84
#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
148
139
   free up some memory, then call this again.  */
149
140
 
150
141
int
151
 
_obstack_begin (h, size, alignment, chunkfun, freefun)
152
 
     struct obstack *h;
153
 
     int size;
154
 
     int alignment;
155
 
#if defined (__STDC__) && __STDC__
156
 
     POINTER (*chunkfun) (long);
157
 
     void (*freefun) (void *);
158
 
#else
159
 
     POINTER (*chunkfun) ();
160
 
     void (*freefun) ();
161
 
#endif
 
142
_obstack_begin (struct obstack *h, int size, int alignment,
 
143
                POINTER (*chunkfun) (long), void (*freefun) (void *))
162
144
{
163
145
  register struct _obstack_chunk *chunk; /* points to new chunk */
164
146
 
181
163
      size = 4096 - extra;
182
164
    }
183
165
 
184
 
#if defined (__STDC__) && __STDC__
185
166
  h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
186
167
  h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
187
 
#else
188
 
  h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
189
 
  h->freefun = freefun;
190
 
#endif
191
168
  h->chunk_size = size;
192
169
  h->alignment_mask = alignment - 1;
193
170
  h->use_extra_arg = 0;
206
183
}
207
184
 
208
185
int
209
 
_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
210
 
     struct obstack *h;
211
 
     int size;
212
 
     int alignment;
213
 
#if defined (__STDC__) && __STDC__
214
 
     POINTER (*chunkfun) (POINTER, long);
215
 
     void (*freefun) (POINTER, POINTER);
216
 
#else
217
 
     POINTER (*chunkfun) ();
218
 
     void (*freefun) ();
219
 
#endif
220
 
     POINTER arg;
 
186
_obstack_begin_1 (struct obstack *h, int size, int alignment,
 
187
                  POINTER (*chunkfun) (POINTER, long),
 
188
                  void (*freefun) (POINTER, POINTER), POINTER arg)
221
189
{
222
190
  register struct _obstack_chunk *chunk; /* points to new chunk */
223
191
 
240
208
      size = 4096 - extra;
241
209
    }
242
210
 
243
 
#if defined(__STDC__) && __STDC__
244
211
  h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
245
212
  h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
246
 
#else
247
 
  h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
248
 
  h->freefun = freefun;
249
 
#endif
250
213
  h->chunk_size = size;
251
214
  h->alignment_mask = alignment - 1;
252
215
  h->extra_arg = arg;
272
235
   to the beginning of the new one.  */
273
236
 
274
237
void
275
 
_obstack_newchunk (h, length)
276
 
     struct obstack *h;
277
 
     int length;
 
238
_obstack_newchunk (struct obstack *h, int length)
278
239
{
279
240
  register struct _obstack_chunk *old_chunk = h->chunk;
280
241
  register struct _obstack_chunk *new_chunk;
335
296
   This is here for debugging.
336
297
   If you use it in a program, you are probably losing.  */
337
298
 
338
 
#if defined (__STDC__) && __STDC__
339
299
/* Suppress -Wmissing-prototypes warning.  We don't want to declare this in
340
300
   obstack.h because it is just for debugging.  */
341
301
int _obstack_allocated_p (struct obstack *h, POINTER obj);
342
 
#endif
343
302
 
344
303
int
345
 
_obstack_allocated_p (h, obj)
346
 
     struct obstack *h;
347
 
     POINTER obj;
 
304
_obstack_allocated_p (struct obstack *h, POINTER obj)
348
305
{
349
306
  register struct _obstack_chunk *lp;   /* below addr of any objects in this chunk */
350
307
  register struct _obstack_chunk *plp;  /* point to previous chunk if any */
370
327
   This is the first one, called from non-ANSI code.  */
371
328
 
372
329
void
373
 
_obstack_free (h, obj)
374
 
     struct obstack *h;
375
 
     POINTER obj;
 
330
_obstack_free (struct obstack *h, POINTER obj)
376
331
{
377
332
  register struct _obstack_chunk *lp;   /* below addr of any objects in this chunk */
378
333
  register struct _obstack_chunk *plp;  /* point to previous chunk if any */
404
359
/* This function is used from ANSI code.  */
405
360
 
406
361
void
407
 
obstack_free (h, obj)
408
 
     struct obstack *h;
409
 
     POINTER obj;
 
362
obstack_free (struct obstack *h, POINTER obj)
410
363
{
411
364
  register struct _obstack_chunk *lp;   /* below addr of any objects in this chunk */
412
365
  register struct _obstack_chunk *plp;  /* point to previous chunk if any */
436
389
}
437
390
 
438
391
int
439
 
_obstack_memory_used (h)
440
 
     struct obstack *h;
 
392
_obstack_memory_used (struct obstack *h)
441
393
{
442
394
  register struct _obstack_chunk* lp;
443
395
  register int nbytes = 0;
462
414
#endif
463
415
 
464
416
static void
465
 
print_and_abort ()
 
417
print_and_abort (void)
466
418
{
467
419
  fputs (_("memory exhausted\n"), stderr);
468
420
  exit (obstack_exit_failure);
475
427
/* Now define the functional versions of the obstack macros.
476
428
   Define them to simply use the corresponding macros to do the job.  */
477
429
 
478
 
#if defined (__STDC__) && __STDC__
479
 
/* These function definitions do not work with non-ANSI preprocessors;
480
 
   they won't pass through the macro names in parentheses.  */
481
 
 
482
430
/* The function names appear in parentheses in order to prevent
483
431
   the macro-definitions of the names from being expanded there.  */
484
432
 
485
 
POINTER (obstack_base) (obstack)
486
 
     struct obstack *obstack;
 
433
POINTER (obstack_base) (struct obstack *obstack)
487
434
{
488
435
  return obstack_base (obstack);
489
436
}
490
437
 
491
 
POINTER (obstack_next_free) (obstack)
492
 
     struct obstack *obstack;
 
438
POINTER (obstack_next_free) (struct obstack *obstack)
493
439
{
494
440
  return obstack_next_free (obstack);
495
441
}
496
442
 
497
 
int (obstack_object_size) (obstack)
498
 
     struct obstack *obstack;
 
443
int (obstack_object_size) (struct obstack *obstack)
499
444
{
500
445
  return obstack_object_size (obstack);
501
446
}
502
447
 
503
 
int (obstack_room) (obstack)
504
 
     struct obstack *obstack;
 
448
int (obstack_room) (struct obstack *obstack)
505
449
{
506
450
  return obstack_room (obstack);
507
451
}
508
452
 
509
 
int (obstack_make_room) (obstack, length)
510
 
     struct obstack *obstack;
511
 
     int length;
 
453
int (obstack_make_room) (struct obstack *obstack, int length)
512
454
{
513
455
  return obstack_make_room (obstack, length);
514
456
}
515
457
 
516
 
void (obstack_grow) (obstack, pointer, length)
517
 
     struct obstack *obstack;
518
 
     POINTER pointer;
519
 
     int length;
 
458
void (obstack_grow) (struct obstack *obstack, POINTER pointer, int length)
520
459
{
521
460
  obstack_grow (obstack, pointer, length);
522
461
}
523
462
 
524
 
void (obstack_grow0) (obstack, pointer, length)
525
 
     struct obstack *obstack;
526
 
     POINTER pointer;
527
 
     int length;
 
463
void (obstack_grow0) (struct obstack *obstack, POINTER pointer, int length)
528
464
{
529
465
  obstack_grow0 (obstack, pointer, length);
530
466
}
531
467
 
532
 
void (obstack_1grow) (obstack, character)
533
 
     struct obstack *obstack;
534
 
     int character;
 
468
void (obstack_1grow) (struct obstack *obstack, int character)
535
469
{
536
470
  obstack_1grow (obstack, character);
537
471
}
538
472
 
539
 
void (obstack_blank) (obstack, length)
540
 
     struct obstack *obstack;
541
 
     int length;
 
473
void (obstack_blank) (struct obstack *obstack, int length)
542
474
{
543
475
  obstack_blank (obstack, length);
544
476
}
545
477
 
546
 
void (obstack_1grow_fast) (obstack, character)
547
 
     struct obstack *obstack;
548
 
     int character;
 
478
void (obstack_1grow_fast) (struct obstack *obstack, int character)
549
479
{
550
480
  obstack_1grow_fast (obstack, character);
551
481
}
552
482
 
553
 
void (obstack_blank_fast) (obstack, length)
554
 
     struct obstack *obstack;
555
 
     int length;
 
483
void (obstack_blank_fast) (struct obstack *obstack, int length)
556
484
{
557
485
  obstack_blank_fast (obstack, length);
558
486
}
559
487
 
560
 
POINTER (obstack_finish) (obstack)
561
 
     struct obstack *obstack;
 
488
POINTER (obstack_finish) (struct obstack *obstack)
562
489
{
563
490
  return obstack_finish (obstack);
564
491
}
565
492
 
566
 
POINTER (obstack_alloc) (obstack, length)
567
 
     struct obstack *obstack;
568
 
     int length;
 
493
POINTER (obstack_alloc) (struct obstack *obstack, int length)
569
494
{
570
495
  return obstack_alloc (obstack, length);
571
496
}
572
497
 
573
 
POINTER (obstack_copy) (obstack, pointer, length)
574
 
     struct obstack *obstack;
575
 
     POINTER pointer;
576
 
     int length;
 
498
POINTER (obstack_copy) (struct obstack *obstack, POINTER pointer, int length)
577
499
{
578
500
  return obstack_copy (obstack, pointer, length);
579
501
}
580
502
 
581
 
POINTER (obstack_copy0) (obstack, pointer, length)
582
 
     struct obstack *obstack;
583
 
     POINTER pointer;
584
 
     int length;
 
503
POINTER (obstack_copy0) (struct obstack *obstack, POINTER pointer, int length)
585
504
{
586
505
  return obstack_copy0 (obstack, pointer, length);
587
506
}
588
507
 
589
 
#endif /* __STDC__ */
590
 
 
591
508
#endif /* 0 */
592
509
 
593
510
#endif  /* !ELIDE_CODE */