summaryrefslogtreecommitdiff
path: root/libshouldbeinlibc/idvec.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-25 22:13:55 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-25 22:33:49 +0200
commit69056411a354300a17d1e92027435c988508655d (patch)
tree0d3741400b400cef79c7bf52625adc8966f2207f /libshouldbeinlibc/idvec.h
parentf605070d37c741436b5f82745eae2a5c018e304d (diff)
Fix extern inline use
* ext2fs/Makefile (SRCS): Add xinl.c * libtreefs/Makefile (OTHERSRCS): Likewise. * term/Makefile (SRCS): Likewise. * ufs/Makefile (SRCS): Likewise. * hostmux/hostmux-xinl.c: Define HOSTMUX_DEFINE_EI instead of HOSTMUX_EI. * libdiskfs/extern-inline.c: Define DISKFS_DEFINE_EXTERN_INLINE instead of DISKFS_EXTERN_INLINE. * libftpconn/xinl.c: Define FTP_CONN_DEFINE_EI instead of FTP_CONN_EI. * libpipe/pipe-funcs.c: Define PIPE_DEFINE_EI instead of PIPE_EI. * libpipe/pq-funcs.c: Define PQ_DEFINE_EI instead of PQ_EI. * libshouldbeinlibc/idvec-funcs.c: Define IDVEC_DEFINE_EI instead of IDVEC_EI. * libshouldbeinlibc/maptime-funcs.c: Define MAPTIME_DEFINE_EI instead of MAPTIME_EI. * libshouldbeinlibc/ugids-xinl.c: Define UGIDS_DEFINE_EI instead of UGIDS_EI. * libstore/xinl.c: Define STORE_DEFINE_EI instead of STORE_EI. * libthreads/rwlock.c: Define RWLOCK_DEFINE_EI instead of RWLOCK_EI. * ext2fs/xinl.c: New file, define EXT2FS_DEFINE_EI and include "ext2fs.h" * libtreefs/xinl.c: New file, define TREEFS_DEFINE_EI and include "treefs.h" and "mig-decls.h". * term/xinl.c: New file, define TERM_DEFINE_EI and include "term.h". * ufs/xinl.c: New file, define UFS_DEFINE_EI and include "ufs.h" * ext2fs/ext2fs.h: Include <features.h>, define EXT2FS_EI to __extern_inline instead of "extern inline", define it to empty when EXT2FS_DEFINE_EI is defined. Always declare extern inline prototypes, and define extern inlines content only if __USE_EXTERN_INLINES or EXT2FS_DEFINE_EI is defined. * libdiskfs/diskfs.h: Likewise with DISKFS_EXTERN_INLINE and DISKFS_DEFINE_EXTERN_INLINE. * libftpconn/ftpconn.h: Likewise with FTP_CONN_EI and FTP_CONN_DEFINE_EI. * libftpconn/priv.h: Likewise. * libpipe/pipe.h: Likewise with PIPE_EI and PIPE_DEFINE_EI. * libpipe/pq.h: Likewise with PQ_EI and PQ_DEFINE_EI. * libshouldbeinlibc/idvec.h: Likewise with IDVEC_EI and IDVEC_DEFINE_EI. * libshouldbeinlibc/maptime.h: Likewise with MAPTIME_EI and MAPTIME_DEFINE_EI. * libshouldbeinlibc/ugids.h: Likewise with UGIDS_EI and UGIDS_DEFINE_EI. * libstore/store.h: Likewise with STORE_EI and STORE_DEFINE_EI. * libthreads/rwlock.h: Likewise with RWLOCK_EI and RWLOCK_DEFINE_EI. * term/term.h: Likewise with TERM_EI and TERM_DEFINE_EI. * ufs/ufs.h: Likewise with UFS_EI and UFS_DEFINE_EI. * libtreefs/treefs.h: Include <features.h>, define TREE_FS_EI to __extern_inline, or to empty when TREEFS_DEFINE_EI is defined. Use TREEFS_EI instead of "extern inline". * libtreefs/mig-decls.h: Use TREEFS_EI instead of "extern inline".
Diffstat (limited to 'libshouldbeinlibc/idvec.h')
-rw-r--r--libshouldbeinlibc/idvec.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/libshouldbeinlibc/idvec.h b/libshouldbeinlibc/idvec.h
index 3c70a5d7..abbc273e 100644
--- a/libshouldbeinlibc/idvec.h
+++ b/libshouldbeinlibc/idvec.h
@@ -24,9 +24,12 @@
#include <hurd/hurd_types.h>
#include <errno.h>
#include <string.h>
+#include <features.h>
-#ifndef IDVEC_EI
-#define IDVEC_EI extern inline
+#ifdef IDVEC_DEFINE_EI
+#define IDVEC_EI
+#else
+#define IDVEC_EI __extern_inline
#endif
struct idvec
@@ -50,6 +53,14 @@ void idvec_free_wrapper (struct idvec *idvec);
/* Free IDVEC and any storage associated with it. */
void idvec_free (struct idvec *idvec);
+extern void idvec_clear (struct idvec *idvec);
+
+extern int idvec_is_empty (const struct idvec *idvec);
+
+extern int idvec_equal (const struct idvec *idvec1, const struct idvec *idvec2);
+
+#if defined(__USE_EXTERN_INLINES) || defined(IDVEC_DEFINE_EI)
+
/* Mark IDVEC as not containing any ids. */
IDVEC_EI void
idvec_clear (struct idvec *idvec)
@@ -74,6 +85,8 @@ idvec_equal (const struct idvec *idvec1, const struct idvec *idvec2)
|| memcmp (idvec1->ids, idvec2->ids, num * sizeof *idvec1->ids) == 0);
}
+#endif /* Use extern inlines. */
+
/* Ensure that IDVEC has enough spaced allocated to hold NUM ids, thus
ensuring that any subsequent ids added won't return a memory allocation
error unless it would result in more ids that NUM. ENOMEM is returned if
@@ -87,6 +100,10 @@ error_t idvec_grow (struct idvec *idvec, unsigned inc);
/* Returns true if IDVEC contains ID, at or after position POS. */
int idvec_tail_contains (const struct idvec *idvec, unsigned pos, uid_t id);
+extern int idvec_contains (const struct idvec *idvec, uid_t id);
+
+#if defined(__USE_EXTERN_INLINES) || defined(IDVEC_DEFINE_EI)
+
/* Returns true if IDVEC contains ID. */
IDVEC_EI int
idvec_contains (const struct idvec *idvec, uid_t id)
@@ -94,6 +111,8 @@ idvec_contains (const struct idvec *idvec, uid_t id)
return idvec_tail_contains (idvec, 0, id);
}
+#endif /* Use extern inlines. */
+
/* Insert ID into IDVEC at position POS, returning ENOMEM if there wasn't
enough memory, or 0. */
error_t idvec_insert (struct idvec *idvec, unsigned pos, uid_t id);