~ubuntu-branches/ubuntu/jaunty/gnupg2/jaunty-security

« back to all changes in this revision

Viewing changes to gl/allocsa.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Safe automatic memory allocation.
2
 
   Copyright (C) 2003-2004 Free Software Foundation, Inc.
 
2
   Copyright (C) 2003-2006 Free Software Foundation, Inc.
3
3
   Written by Bruno Haible <bruno@clisp.org>, 2003.
4
4
 
5
5
   This program is free software; you can redistribute it and/or modify
6
6
   it under the terms of the GNU General Public License as published by
7
 
   the Free Software Foundation; either version 2, or (at your option)
 
7
   the Free Software Foundation; either version 3, or (at your option)
8
8
   any later version.
9
9
 
10
10
   This program is distributed in the hope that it will be useful,
13
13
   GNU General Public License for more details.
14
14
 
15
15
   You should have received a copy of the GNU General Public License
16
 
   along with this program; if not, write to the Free Software Foundation,
17
 
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
16
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
18
17
 
19
18
#ifndef _ALLOCSA_H
20
19
#define _ALLOCSA_H
23
22
#include <stddef.h>
24
23
#include <stdlib.h>
25
24
 
 
25
 
 
26
#ifdef __cplusplus
 
27
extern "C" {
 
28
#endif
 
29
 
 
30
 
26
31
/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
27
32
   alloca(N); otherwise it returns NULL.  It either returns N bytes of
28
33
   memory allocated on the stack, that lasts until the function returns,
69
74
   If this would be useful in your application. please speak up.  */
70
75
 
71
76
 
 
77
#ifdef __cplusplus
 
78
}
 
79
#endif
 
80
 
 
81
 
72
82
/* ------------------- Auxiliary, non-public definitions ------------------- */
73
83
 
74
84
/* Determine the alignment of a type at compile time.  */
81
91
  /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
82
92
     values.  */
83
93
# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
 
94
#elif defined _AIX
 
95
  /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
 
96
     values.  */
 
97
# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
84
98
#else
85
99
# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
86
100
#endif
91
105
   among all elementary types.  */
92
106
  sa_alignment_long = sa_alignof (long),
93
107
  sa_alignment_double = sa_alignof (double),
94
 
#ifdef HAVE_LONG_LONG
 
108
#ifdef HAVE_LONG_LONG_INT
95
109
  sa_alignment_longlong = sa_alignof (long long),
96
110
#endif
97
111
#ifdef HAVE_LONG_DOUBLE
98
112
  sa_alignment_longdouble = sa_alignof (long double),
99
113
#endif
100
114
  sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
101
 
#ifdef HAVE_LONG_LONG
 
115
#ifdef HAVE_LONG_LONG_INT
102
116
                      | (sa_alignment_longlong - 1)
103
117
#endif
104
118
#ifdef HAVE_LONG_DOUBLE