root/openpgpsdk/trunk/include/openpgpsdk/util.h

Revision 619 (checked in by rachel, 5 years ago)

Doxygen changes

Line 
1 /*
2  * Copyright (c) 2005-2008 Nominet UK (www.nic.uk)
3  * All rights reserved.
4  * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
5  * their moral rights under the UK Copyright Design and Patents Act 1988 to
6  * be recorded as the authors of this copyright work.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
9  * use this file except in compliance with the License.
10  *
11  * You may obtain a copy of the License at
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21
22 /** \file
23  */
24
25 #ifndef OPS_UTIL_H
26 #define OPS_UTIL_H
27
28 #include "openpgpsdk/types.h"
29 #include "openpgpsdk/create.h"
30 #include "openpgpsdk/packet-parse.h"
31 #include <stdlib.h>
32
33 #define ops_false       0
34 #define ops_true        1
35
36 void hexdump(const unsigned char *src,size_t length);
37
38 /*
39  * These macros code ensures that you are casting what you intend to cast.
40  * It works because in "a ? b : c", b and c must have the same type.
41  * This is a copy of the macro defined in openssl/asn1.h.
42  */
43 #ifndef CHECKED_PTR_OF
44 #define CHECKED_PTR_OF(type, p) ((void*) (1 ? p : (type *)0))
45 #endif
46 #define CHECKED_INSTANCE_OF(type, p) (1 ? p : (type)0)
47 #define DECONST(type,p) ((type *)CHECKED_PTR_OF(const type, p))
48
49 /* number of elements in an array */
50 #define OPS_ARRAY_SIZE(a)       (sizeof(a)/sizeof(*(a)))
51
52 void *ops_mallocz(size_t n);
53
54 #endif
55
Note: See TracBrowser for help on using the browser.