aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1998-02-14 08:18:56 +0000
committerTheodore Tso <tytso@mit.edu>1998-02-14 08:18:56 +0000
commit7a96456c8e81c48f4ce5a8a1ddca37e7fafec33b (patch)
tree6d9a8b3291aa70ba83011a1d89ede9d3ea5910fb /src
parent9cb15d118e17697d8b969a05b1065f20a4c84aff (diff)
downloadkrb5-7a96456c8e81c48f4ce5a8a1ddca37e7fafec33b.zip
krb5-7a96456c8e81c48f4ce5a8a1ddca37e7fafec33b.tar.gz
krb5-7a96456c8e81c48f4ce5a8a1ddca37e7fafec33b.tar.bz2
asn1buf.h (asn1buf_insert_octet): Use static inline function to define
asn1_insert_octet, since the GCC specific hack we're using doesn't work on GCC compilers that also have Objective C enabled. asn1buf.c: define ASN1BUF_OMIT_INLINE_FUNCS before including asn1buf.h, since we don't want inline functions declared when we're defining the linkable version of the functions. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10457 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/krb5/asn.1/ChangeLog11
-rw-r--r--src/lib/krb5/asn.1/asn1buf.c2
-rw-r--r--src/lib/krb5/asn.1/asn1buf.h117
3 files changed, 77 insertions, 53 deletions
diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog
index 63c9715..28ccda3 100644
--- a/src/lib/krb5/asn.1/ChangeLog
+++ b/src/lib/krb5/asn.1/ChangeLog
@@ -1,3 +1,14 @@
+Fri Feb 13 22:32:06 1998 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * asn1buf.h (asn1buf_insert_octet): Use static inline function to
+ define asn1_insert_octet, since the GCC specific hack
+ we're using doesn't work on GCC compilers that also have
+ Objective C enabled.
+
+ * asn1buf.c: define ASN1BUF_OMIT_INLINE_FUNCS before including
+ asn1buf.h, since we don't want inline functions declared
+ when we're defining the linkable version of the functions.
+
Mon Feb 2 17:02:29 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Makefile.in: Define BUILDTOP and thisconfigdir in the Makefile
diff --git a/src/lib/krb5/asn.1/asn1buf.c b/src/lib/krb5/asn.1/asn1buf.c
index c7226a1..30dad8b 100644
--- a/src/lib/krb5/asn.1/asn1buf.c
+++ b/src/lib/krb5/asn.1/asn1buf.c
@@ -48,7 +48,9 @@
but no further. (The bound should move out in response
to being crossed by next.)) */
+#define ASN1BUF_OMIT_INLINE_FUNCS
#include "asn1buf.h"
+#undef ASN1BUF_OMIT_INLINE_FUNCS
#include <stdio.h>
asn1_error_code asn1buf_create(buf)
diff --git a/src/lib/krb5/asn.1/asn1buf.h b/src/lib/krb5/asn.1/asn1buf.h
index 1aad777..8103b9e 100644
--- a/src/lib/krb5/asn.1/asn1buf.h
+++ b/src/lib/krb5/asn.1/asn1buf.h
@@ -9,6 +9,57 @@ typedef struct code_buffer_rep {
char *base, *bound, *next;
} asn1buf;
+
+/**************** Private Procedures ****************/
+
+int asn1buf_size
+ PROTOTYPE((const asn1buf *buf));
+/* requires *buf has been created and not destroyed
+ effects Returns the total size
+ PROTOTYPE((in octets) of buf's octet buffer. */
+#define asn1buf_size(buf) \
+ (((buf) == NULL || (buf)->base == NULL) \
+ ? 0 \
+ : ((buf)->bound - (buf)->base + 1))
+
+int asn1buf_free
+ PROTOTYPE((const asn1buf *buf));
+/* requires *buf is allocated
+ effects Returns the number of unused, allocated octets in *buf. */
+#define asn1buf_free(buf) \
+ (((buf) == NULL || (buf)->base == NULL) \
+ ? 0 \
+ : ((buf)->bound - (buf)->next + 1))
+
+
+asn1_error_code asn1buf_ensure_space
+ PROTOTYPE((asn1buf *buf, const int amount));
+/* requires *buf is allocated
+ modifies *buf
+ effects If buf has less than amount octets of free space, then it is
+ expanded to have at least amount octets of free space.
+ Returns ENOMEM memory is exhausted. */
+#define asn1buf_ensure_space(buf,amount) \
+ ((asn1buf_free(buf) < (amount)) \
+ ? (asn1buf_expand((buf), (amount)-asn1buf_free(buf))) \
+ : 0)
+
+
+asn1_error_code asn1buf_expand
+ PROTOTYPE((asn1buf *buf, int inc));
+/* requires *buf is allocated
+ modifies *buf
+ effects Expands *buf by allocating space for inc more octets.
+ Returns ENOMEM if memory is exhausted. */
+
+int asn1buf_len
+ PROTOTYPE((const asn1buf *buf));
+/* requires *buf is allocated
+ effects Returns the length of the encoding in *buf. */
+#define asn1buf_len(buf) ((buf)->next - (buf)->base)
+
+/****** End of private procedures *****/
+
/*
Overview
@@ -82,11 +133,19 @@ asn1_error_code asn1buf_insert_octet
/* requires *buf is allocated
effects Inserts o into the buffer *buf, expanding the buffer if
necessary. Returns ENOMEM memory is exhausted. */
-#if __GNUC__ >= 2
-#define asn1buf_insert_octet(BUF,O) \
- (asn1buf_ensure_space ((BUF),1) \
- ? /* leave this empty -- gcc returns value of first operand */ \
- : (*(BUF)->next++ = (O), 0))
+#if ((__GNUC__ >= 2) && !defined(ASN1BUF_OMIT_INLINE_FUNCS))
+extern inline asn1_error_code asn1buf_insert_octet(buf, o)
+ asn1buf * buf;
+ const int o;
+{
+ asn1_error_code retval;
+
+ retval = asn1buf_ensure_space(buf,1);
+ if(retval) return retval;
+ *(buf->next) = (char)o;
+ (buf->next)++;
+ return 0;
+}
#endif
asn1_error_code asn1buf_insert_octetstring
@@ -158,52 +217,4 @@ int asn1buf_remains
modifies *buf
effects Returns the number of unprocessed octets remaining in *buf. */
-/**************** Private Procedures ****************/
-
-int asn1buf_size
- PROTOTYPE((const asn1buf *buf));
-/* requires *buf has been created and not destroyed
- effects Returns the total size
- PROTOTYPE((in octets) of buf's octet buffer. */
-#define asn1buf_size(buf) \
- (((buf) == NULL || (buf)->base == NULL) \
- ? 0 \
- : ((buf)->bound - (buf)->base + 1))
-
-int asn1buf_free
- PROTOTYPE((const asn1buf *buf));
-/* requires *buf is allocated
- effects Returns the number of unused, allocated octets in *buf. */
-#define asn1buf_free(buf) \
- (((buf) == NULL || (buf)->base == NULL) \
- ? 0 \
- : ((buf)->bound - (buf)->next + 1))
-
-
-asn1_error_code asn1buf_ensure_space
- PROTOTYPE((asn1buf *buf, const int amount));
-/* requires *buf is allocated
- modifies *buf
- effects If buf has less than amount octets of free space, then it is
- expanded to have at least amount octets of free space.
- Returns ENOMEM memory is exhausted. */
-#define asn1buf_ensure_space(buf,amount) \
- ((asn1buf_free(buf) < (amount)) \
- ? (asn1buf_expand((buf), (amount)-asn1buf_free(buf))) \
- : 0)
-
-
-asn1_error_code asn1buf_expand
- PROTOTYPE((asn1buf *buf, int inc));
-/* requires *buf is allocated
- modifies *buf
- effects Expands *buf by allocating space for inc more octets.
- Returns ENOMEM if memory is exhausted. */
-
-int asn1buf_len
- PROTOTYPE((const asn1buf *buf));
-/* requires *buf is allocated
- effects Returns the length of the encoding in *buf. */
-#define asn1buf_len(buf) ((buf)->next - (buf)->base)
-
#endif