diff options
author | sangsu <sangsu.choi@samsung.com> | 2016-06-08 10:17:41 +0900 |
---|---|---|
committer | sangsu <sangsu.choi@samsung.com> | 2016-06-08 10:18:15 +0900 |
commit | a39386a3afe2d7e0cc717a49f970f53d974fda53 (patch) | |
tree | d6deb781410d96006a58fcfcaa8f31ffcc139523 /lib/int.h | |
parent | d2521ee04e00e1c060001d5d67c1cf0bd23ec260 (diff) | |
download | libtasn1-a39386a3afe2d7e0cc717a49f970f53d974fda53.tar.gz libtasn1-a39386a3afe2d7e0cc717a49f970f53d974fda53.tar.bz2 libtasn1-a39386a3afe2d7e0cc717a49f970f53d974fda53.zip |
Imported Upstream version 4.8upstream/4.8submit/upstream/20160613.071414
Change-Id: I25e57ece28b9ebb637a2b7356f57e11b7f2eb807
Signed-off-by: sangsu <sangsu.choi@samsung.com>
Diffstat (limited to 'lib/int.h')
-rw-r--r-- | lib/int.h | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -51,7 +51,6 @@ struct asn1_node_st unsigned int type; /* Node type */ unsigned char *value; /* Node value */ int value_len; - asn1_node up; /* Pointer to the parent node */ asn1_node down; /* Pointer to the son node */ asn1_node right; /* Pointer to the brother node */ asn1_node left; /* Pointer to the next list element */ @@ -98,9 +97,16 @@ typedef struct tag_and_class_st #define ETYPE_TAG(etype) (_asn1_tags[etype].tag) #define ETYPE_CLASS(etype) (_asn1_tags[etype].class) -#define ETYPE_OK(etype) ((etype != ASN1_ETYPE_INVALID && \ - etype <= _asn1_tags_size && \ - _asn1_tags[etype].desc != NULL)?1:0) +#define ETYPE_OK(etype) (((etype) != ASN1_ETYPE_INVALID && \ + (etype) <= _asn1_tags_size && \ + _asn1_tags[(etype)].desc != NULL)?1:0) + +#define ETYPE_IS_STRING(etype) ((etype == ASN1_ETYPE_GENERALSTRING || \ + etype == ASN1_ETYPE_NUMERIC_STRING || etype == ASN1_ETYPE_IA5_STRING || \ + etype == ASN1_ETYPE_TELETEX_STRING || etype == ASN1_ETYPE_PRINTABLE_STRING || \ + etype == ASN1_ETYPE_UNIVERSAL_STRING || etype == ASN1_ETYPE_BMP_STRING || \ + etype == ASN1_ETYPE_UTF8_STRING || etype == ASN1_ETYPE_VISIBLE_STRING || \ + etype == ASN1_ETYPE_OCTET_STRING)?1:0) extern unsigned int _asn1_tags_size; extern const tag_and_class_st _asn1_tags[]; @@ -191,4 +197,20 @@ convert_old_type (unsigned int ntype) return ntype; } +static inline +void *_asn1_realloc(void *ptr, size_t size) +{ + void *ret; + + if (size == 0) + return ptr; + + ret = realloc(ptr, size); + if (ret == NULL) + { + free(ptr); + } + return ret; +} + #endif /* INT_H */ |