* INLINE doesn't work across several objects as of C99; we just survive it the way...
authorWilfried Göesgens <willi@citadel.org>
Tue, 18 May 2010 22:52:46 +0000 (22:52 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 18 May 2010 22:52:46 +0000 (22:52 +0000)
(see http://clang.llvm.org/docs/UsersManual.html#c_modes for details)
Move the INLINE function into the header, make it static INLINE as sugested by jyasskin and sabre

citadel/context.c
citadel/context.h
citadel/file_ops.c
citadel/ldap.c
citadel/modules/expire/expire_policy.c
citadel/room_ops.c
citadel/user_ops.c
citadel/user_ops.h

index b00f6c07c98bffab2183807f825f72e701b03a08..03638d2992e3b65ed32cb1ce73dbe003072caadf 100644 (file)
@@ -583,22 +583,6 @@ void InitializeMasterCC(void) {
 
 
 
-/*
- * Bind a thread to a context.  (It's inline merely to speed things up.)
- */
-INLINE void become_session(CitContext *which_con) {
-/*
-       pid_t tid = syscall(SYS_gettid);
-*/
-       citthread_setspecific(MyConKey, (void *)which_con );
-/*
-       CtdlLogPrintf(CTDL_DEBUG, "[%d]: Now doing %s\n", 
-                     (int) tid, 
-                     ((which_con != NULL) && (which_con->ServiceName != NULL)) ? 
-                     which_con->ServiceName:"");
-*/
-}
-
 
 /*
  * Set the "async waiting" flag for a session, if applicable
index 42e0b289863d0ebc78ded2bc2e3e1fbb81431453..7a71d3b96eb04c79bed04a840b071a75995f5ec9 100644 (file)
@@ -154,7 +154,6 @@ void RemoveContext (struct CitContext *);
 CitContext *CreateNewContext (void);
 void context_cleanup(void);
 void kill_session (int session_to_kill);
-INLINE void become_session(struct CitContext *which_con);
 void InitializeMasterCC(void);
 void dead_session_purge(int force);
 void set_async_waiting(struct CitContext *ccptr);
@@ -169,4 +168,22 @@ int CtdlTerminateOtherSession (int session_num);
 #define TERM_ALLOWED   0x02
 #define TERM_KILLED    0x03
 #define TERM_NOTALLOWED -1
+
+/*
+ * Bind a thread to a context.  (It's inline merely to speed things up.)
+ */
+static INLINE void become_session(CitContext *which_con) {
+/*
+       pid_t tid = syscall(SYS_gettid);
+*/
+       citthread_setspecific(MyConKey, (void *)which_con );
+/*
+       CtdlLogPrintf(CTDL_DEBUG, "[%d]: Now doing %s\n", 
+                     (int) tid, 
+                     ((which_con != NULL) && (which_con->ServiceName != NULL)) ? 
+                     which_con->ServiceName:"");
+*/
+}
+
+
 #endif /* CONTEXT_H */
index 0438b244e2870ff6625baa56cdcd58278cc78c20..f303ac28c857904b9060e2a8e9aeff80173b8978 100644 (file)
@@ -35,7 +35,6 @@
 #include "config.h"
 #include "file_ops.h"
 #include "sysdep_decls.h"
-#include "user_ops.h"
 #include "support.h"
 #include "room_ops.h"
 #include "msgbase.h"
@@ -47,6 +46,7 @@
 #endif
 
 #include "ctdl_module.h"
+#include "user_ops.h"
 
 /*
  * network_talking_to()  --  concurrency checker
index 1ea3bb09b0533db4bd026a9b9a496e59778567b0..2e293276e3734a54b22b0b5b291b47255ca80e29 100644 (file)
@@ -56,7 +56,6 @@ int ctdl_require_ldap_version = 3;
 #include "citadel.h"
 #include "server.h"
 #include "database.h"
-#include "user_ops.h"
 #include "sysdep_decls.h"
 #include "support.h"
 #include "room_ops.h"
@@ -70,6 +69,7 @@ int ctdl_require_ldap_version = 3;
 #include "threads.h"
 #include "citadel_ldap.h"
 #include "ctdl_module.h"
+#include "user_ops.h"
 
 #ifdef HAVE_LDAP
 #define LDAP_DEPRECATED 1      /* Suppress libldap's warning that we are using deprecated API calls */
index 5bf69953c44a527d27391f023a0e926d366b8163..9b2faf1a52999e85f80c5b4a865161723b2832e3 100644 (file)
 #include "room_ops.h"
 #include "sysdep_decls.h"
 #include "support.h"
-#include "user_ops.h"
 #include "msgbase.h"
 #include "citserver.h"
 
 #include "ctdl_module.h"
+#include "user_ops.h"
 
 /*
  * Retrieve the applicable expire policy for a specific room
index baf2b4bf64ad53fa263a91df2ed8870a0bcebeb4..0cba9768b3a4e580b129e67dcc87bac219530061 100644 (file)
@@ -35,7 +35,6 @@
 #include "room_ops.h"
 #include "sysdep_decls.h"
 #include "support.h"
-#include "user_ops.h"
 #include "msgbase.h"
 #include "citserver.h"
 #include "control.h"
@@ -43,6 +42,7 @@
 #include "threads.h"
 
 #include "ctdl_module.h"
+#include "user_ops.h"
 
 struct floor *floorcache[MAXFLOORS];
 
index 4da586ef837db1e3d8bac13104a25d6c3ac76174..294767c68e5cd1412adf69994912a049b2211e3c 100644 (file)
@@ -38,7 +38,6 @@
 #include "citadel.h"
 #include "server.h"
 #include "database.h"
-#include "user_ops.h"
 #include "sysdep_decls.h"
 #include "support.h"
 #include "room_ops.h"
 
 #include "ctdl_module.h"
 
+////#define CTDL_INLINE_USR INLINE
+#include "user_ops.h"
+
 /* These pipes are used to talk to the chkpwd daemon, which is forked during startup */
 int chkpwd_write_pipe[2];
 int chkpwd_read_pipe[2];
 
 
-INLINE long cutuserkey(char *username) {
-       long len;
-       len = strlen(username);
-       if (len >= USERNAME_SIZE)
-       {
-               CtdlLogPrintf (CTDL_EMERG, "Username to long: %s", username);
-               cit_backtrace ();
-               len = USERNAME_SIZE - 1; 
-               ((char*)username)[USERNAME_SIZE - 1]='\0';
-       }
-       return len;
-}
-
-/*
- * makeuserkey() - convert a username into the format used as a database key
- *              (it's just the username converted into lower case)
- */
-INLINE void makeuserkey(char *key, const char *username, long len) {
-       int i;
-
-       if (len >= USERNAME_SIZE)
-       {
-               CtdlLogPrintf (CTDL_EMERG, "Username to long: %s", username);
-               cit_backtrace ();
-               len = USERNAME_SIZE - 1; 
-       }
-       for (i=0; i<=len; ++i) {
-               key[i] = tolower(username[i]);
-       }
-}
-
 
 /*
  * getuser()  -  retrieve named user into supplied buffer.
index 8355e3e7891eb8ef892a8047c0974ee871fdc2a0..41899ad91dcf0cc75b80737592d371cf3776870a 100644 (file)
@@ -1,3 +1,7 @@
+#ifndef __USER_OPS_H__
+#define __USER_OPS_H__
+
+#include <ctype.h>
 /* $Id$ */
 int hash (char *str);
 /* getuser is deprecated, use CtdlGetUser instead */
@@ -54,7 +58,45 @@ void start_chkpwd_daemon(void);
 #define RENAMEUSER_ALREADY_EXISTS      3       /* An account with the desired new name already exists */
 
 int rename_user(char *oldname, char *newname);
-INLINE void makeuserkey(char *key, const char *username, long len);
-INLINE long cutuserkey(char *username);
+
+///#ifndef CTDL_INLINE_USR
+////#define CTDL_INLINE_USR static INLINE
+///#endif
+
+///CTDL_INLINE_USR 
+static INLINE long cutuserkey(char *username) { 
+       long len;
+       len = strlen(username);
+       if (len >= USERNAME_SIZE)
+       {
+               CtdlLogPrintf (CTDL_EMERG, "Username to long: %s", username);
+               cit_backtrace ();
+               len = USERNAME_SIZE - 1; 
+               ((char*)username)[USERNAME_SIZE - 1]='\0';
+       }
+       return len;
+}
+
+/*
+ * makeuserkey() - convert a username into the format used as a database key
+ *              (it's just the username converted into lower case)
+ */
+///CTDL_INLINE_USR 
+static INLINE void makeuserkey(char *key, const char *username, long len) {
+       int i;
+
+       if (len >= USERNAME_SIZE)
+       {
+               CtdlLogPrintf (CTDL_EMERG, "Username to long: %s", username);
+               cit_backtrace ();
+               len = USERNAME_SIZE - 1; 
+       }
+       for (i=0; i<=len; ++i) {
+               key[i] = tolower(username[i]);
+       }
+}
+
 
 int internal_create_user (const char *username, long len, struct ctdluser *usbuf, uid_t uid);
+
+#endif