5 /* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
6 file accompanying popt source distributions, available from
7 ftp://ftp.rpm.org/pub/rpm/dist. */
13 * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
14 * @param p memory to free
17 /*@unused@*/ static inline /*@null@*/ void *
18 _free(/*@only@*/ /*@null@*/ const void * p
)
21 if (p
!= NULL
) free((void *)p
);
26 isSpace(const char *ptr
)
28 return isspace(*(unsigned char *)ptr
);
31 /* Bit mask macros. */
32 /*@-exporttype -redef @*/
33 typedef unsigned int __pbm_bits
;
34 /*@=exporttype =redef @*/
35 #define __PBM_NBITS (8 * sizeof (__pbm_bits))
36 #define __PBM_IX(d) ((d) / __PBM_NBITS)
37 #define __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
38 /*@-exporttype -redef @*/
42 /*@=exporttype =redef @*/
43 #define __PBM_BITS(set) ((set)->bits)
45 #define PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
46 #define PBM_FREE(s) _free(s);
47 #define PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
48 #define PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
49 #define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
51 struct optionStackEntry
{
60 /*@observer@*/ /*@null@*/
61 const char * nextCharArg
;
62 /*@dependent@*/ /*@null@*/
67 struct poptContext_s
{
68 struct optionStackEntry optionStack
[POPT_OPTION_DEPTH
];
70 struct optionStackEntry
* os
;
71 /*@owned@*/ /*@null@*/
72 const char ** leftovers
;
76 const struct poptOption
* options
;
84 /*@owned@*/ /*@null@*/
88 const char ** finalArgv
;
91 /*@dependent@*/ /*@null@*/
94 const char * execPath
;
96 /*@only@*/ /*@relnull@*/
97 const char * otherHelp
;
102 #ifdef HAVE_LIBINTL_H
106 #if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
107 #define _(foo) gettext(foo)
112 #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
113 #define D_(dom, str) dgettext(dom, str)
114 #define POPT_(foo) D_("popt", foo)
116 #define D_(dom, str) str
117 #define POPT_(foo) foo