~ubuntu-branches/ubuntu/karmic/popt/karmic

« back to all changes in this revision

Viewing changes to system.h

  • Committer: Bazaar Package Importer
  • Author(s): Paul Martin
  • Date: 2008-06-25 07:25:34 UTC
  • mfrom: (4.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080625072534-sc91ls37wk5gqrbq
Tags: 1.14-4
Remove locale data from the udeb, and change the package 
description. The debian-installer developers are sure that they 
don't need the localization information, mainly error messages.
(Thanks to Frans Pop for bringing this to my attention.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file popt/system.h
 
3
 */
 
4
 
1
5
#ifdef HAVE_CONFIG_H
2
6
#include "config.h"
3
7
#endif
13
17
 
14
18
#include <ctype.h>
15
19
 
 
20
/* XXX isspace(3) has i18n encoding signednesss issues on Solaris. */
 
21
#define _isspaceptr(_chp)       isspace((int)(*(unsigned char *)(_chp)))
 
22
 
16
23
#include <errno.h>
17
24
#include <fcntl.h>
18
25
#include <limits.h>
19
26
 
20
 
#if HAVE_MCHECK_H 
 
27
#ifdef HAVE_MCHECK_H
21
28
#include <mcheck.h>
22
29
#endif
23
30
 
25
32
#include <stdlib.h>
26
33
#include <string.h>
27
34
 
28
 
#if HAVE_UNISTD_H
 
35
#ifdef HAVE_UNISTD_H
29
36
#include <unistd.h>
30
37
#endif
31
38
 
35
42
#include <libc.h>
36
43
#endif
37
44
 
38
 
#if defined(__LCLINT__)
39
 
/*@-declundef -incondefs @*/ /* LCL: missing annotation */
40
 
/*@only@*/ /*@out@*/
41
 
void * alloca (size_t __size)
42
 
        /*@ensures MaxSet(result) == (__size - 1) @*/
 
45
/*@-incondefs@*/
 
46
/*@mayexit@*/ /*@only@*/ /*@out@*/ /*@unused@*/
 
47
void * xmalloc (size_t size)
 
48
        /*@globals errno @*/
 
49
        /*@ensures maxSet(result) == (size - 1) @*/
 
50
        /*@modifies errno @*/;
 
51
 
 
52
/*@mayexit@*/ /*@only@*/ /*@unused@*/
 
53
void * xcalloc (size_t nmemb, size_t size)
 
54
        /*@ensures maxSet(result) == (nmemb - 1) @*/
43
55
        /*@*/;
44
 
/*@=declundef =incondefs @*/
45
 
#endif
46
 
 
47
 
/* AIX requires this to be the first thing in the file.  */ 
48
 
#ifndef __GNUC__
49
 
# if HAVE_ALLOCA_H
50
 
#  include <alloca.h>
51
 
# else
52
 
#  ifdef _AIX
53
 
#pragma alloca
54
 
#  else
55
 
#   ifndef alloca /* predefined by HP cc +Olibcalls */
56
 
char *alloca ();
57
 
#   endif
58
 
#  endif
59
 
# endif
60
 
#elif defined(__GNUC__) && defined(__STRICT_ANSI__)
61
 
#define alloca __builtin_alloca
62
 
#endif
63
 
 
64
 
/*@-redecl -redef@*/
 
56
 
 
57
/*@mayexit@*/ /*@only@*/ /*@unused@*/
 
58
void * xrealloc (/*@null@*/ /*@only@*/ void * ptr, size_t size)
 
59
        /*@ensures maxSet(result) == (size - 1) @*/
 
60
        /*@modifies *ptr @*/;
 
61
 
65
62
/*@mayexit@*/ /*@only@*/ /*@unused@*/
66
63
char * xstrdup (const char *str)
67
64
        /*@*/;
68
 
/*@=redecl =redef@*/
69
 
 
70
 
#if HAVE_MCHECK_H && defined(__GNUC__)
 
65
/*@=incondefs@*/
 
66
 
 
67
#if !defined(HAVE_STPCPY)
 
68
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
 
69
static inline char * stpcpy (char *dest, const char * src) {
 
70
    register char *d = dest;
 
71
    register const char *s = src;
 
72
 
 
73
    do
 
74
        *d++ = *s;
 
75
    while (*s++ != '\0');
 
76
    return d - 1;
 
77
}
 
78
#endif
 
79
 
 
80
/* Memory allocation via macro defs to get meaningful locations from mtrace() */
 
81
#if defined(HAVE_MCHECK_H) && defined(__GNUC__)
71
82
#define vmefail()       (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
 
83
#define xmalloc(_size)          (malloc(_size) ? : vmefail())
 
84
#define xcalloc(_nmemb, _size)  (calloc((_nmemb), (_size)) ? : vmefail())
 
85
#define xrealloc(_ptr, _size)   (realloc((_ptr), (_size)) ? : vmefail())
72
86
#define xstrdup(_str)   (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
73
87
#else
 
88
#define xmalloc(_size)          malloc(_size)
 
89
#define xcalloc(_nmemb, _size)  calloc((_nmemb), (_size))
 
90
#define xrealloc(_ptr, _size)   realloc((_ptr), (_size))
74
91
#define xstrdup(_str)   strdup(_str)
75
 
#endif  /* HAVE_MCHECK_H && defined(__GNUC__) */
 
92
#endif  /* defined(HAVE_MCHECK_H) && defined(__GNUC__) */
76
93
 
77
 
#if HAVE___SECURE_GETENV && !defined(__LCLINT__)
 
94
#if defined(HAVE___SECURE_GETENV) && !defined(__LCLINT__)
78
95
#define getenv(_s)      __secure_getenv(_s)
79
96
#endif
80
97
 
 
98
#if !defined(__GNUC__) && !defined(__attribute__)
 
99
#define __attribute__(x) 
 
100
#endif
 
101
#define UNUSED(x) x __attribute__((__unused__))
 
102
 
81
103
#include "popt.h"