diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-09-13 21:30:33 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-09-13 21:30:33 +0200 |
commit | 4b8b8ccb3e96c4de1409f9ce701b870a53a2b720 (patch) | |
tree | 28c1a7496e856539b76b4c079ba8187dd6908593 /lib/element.c | |
parent | 94976d02fb6f3205ae2a05dfa6069bedfe1b547a (diff) | |
download | libtasn1-4b8b8ccb3e96c4de1409f9ce701b870a53a2b720.tar.gz libtasn1-4b8b8ccb3e96c4de1409f9ce701b870a53a2b720.tar.bz2 libtasn1-4b8b8ccb3e96c4de1409f9ce701b870a53a2b720.zip |
Eliminated _asn1_malloc, _asn1_free and _asn_calloc.
Diffstat (limited to 'lib/element.c')
-rw-r--r-- | lib/element.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/lib/element.c b/lib/element.c index ea8eb48..2ee4950 100644 --- a/lib/element.c +++ b/lib/element.c @@ -343,8 +343,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, { if ((isdigit (value[0])) || (value[0] == '-')) { - value_temp = - (unsigned char *) _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT); + value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); if (value_temp == NULL) return ASN1_MEM_ALLOC_ERROR; @@ -362,9 +361,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, { if (!_asn1_strcmp (p->name, value)) { - value_temp = - (unsigned char *) - _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT); + value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); if (value_temp == NULL) return ASN1_MEM_ALLOC_ERROR; @@ -383,7 +380,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, } else { /* len != 0 */ - value_temp = (unsigned char *) _asn1_malloc (len); + value_temp = malloc (len); if (value_temp == NULL) return ASN1_MEM_ALLOC_ERROR; memcpy (value_temp, value, len); @@ -397,7 +394,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, if (negative && (type_field (node->type) == TYPE_ENUMERATED)) { - _asn1_free (value_temp); + free (value_temp); return ASN1_VALUE_NOT_VALID; } @@ -420,11 +417,10 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, p = p->right; if ((isdigit (p->value[0])) || (p->value[0] == '-')) { - default_temp = - (unsigned char *) _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT); + default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); if (default_temp == NULL) { - _asn1_free (value_temp); + free (value_temp); return ASN1_MEM_ALLOC_ERROR; } @@ -435,7 +431,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, { /* is an identifier like v1 */ if (!(node->type & CONST_LIST)) { - _asn1_free (value_temp); + free (value_temp); return ASN1_VALUE_NOT_VALID; } p2 = node->down; @@ -445,12 +441,10 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, { if (!_asn1_strcmp (p2->name, p->value)) { - default_temp = - (unsigned char *) - _asn1_malloc (SIZEOF_UNSIGNED_LONG_INT); + default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); if (default_temp == NULL) { - _asn1_free (value_temp); + free (value_temp); return ASN1_MEM_ALLOC_ERROR; } @@ -465,7 +459,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, } if (p2 == NULL) { - _asn1_free (value_temp); + free (value_temp); return ASN1_VALUE_NOT_VALID; } } @@ -481,9 +475,9 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, if (k2 == len2) _asn1_set_value (node, NULL, 0); } - _asn1_free (default_temp); + free (default_temp); } - _asn1_free (value_temp); + free (value_temp); break; case TYPE_OBJECT_ID: for (i = 0; i < _asn1_strlen (value); i++) @@ -562,7 +556,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name, if (len == 0) len = _asn1_strlen (value); asn1_length_der ((len >> 3) + 2, NULL, &len2); - temp = (unsigned char *) _asn1_malloc ((len >> 3) + 2 + len2); + temp = malloc ((len >> 3) + 2 + len2); if (temp == NULL) return ASN1_MEM_ALLOC_ERROR; |