[core] include and use hedley (v15) header
hedley is a single header to handle compiler-specific features: https://nemequ.github.io/hedley/ Prefer headly macros over glib for now. Change-Id: I3c67ebee0d43e27fde6402d47788e1045144e864personal/stbuehler/wip
parent
b41e02860c
commit
4a4fd8fd11
2
COPYING
2
COPYING
|
@ -32,3 +32,5 @@ From doc/bootstrap* (Apache License 2.0):
|
|||
Licensed under http://www.apache.org/licenses/LICENSE-2.0
|
||||
From doc/jquery-1.10.1.min.js (MIT License):
|
||||
(c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
|
||||
|
||||
Also include/lighttpd/hedley.h is licensed as CC0-1.0 by Evan Nemerson.
|
||||
|
|
|
@ -72,10 +72,10 @@ struct liLog {
|
|||
LI_API void li_log_init(liServer *srv);
|
||||
LI_API void li_log_clean(liServer *srv);
|
||||
|
||||
LI_API void li_log_write(liServer *srv, liLogLevel log_level, guint flags, const gchar *fmt, ...) G_GNUC_PRINTF(4, 5);
|
||||
LI_API void li_log_write(liServer *srv, liLogLevel log_level, guint flags, const gchar *fmt, ...) HEDLEY_PRINTF_FORMAT(4, 5);
|
||||
|
||||
/* replaces '\r' and '\n' with '\0' */
|
||||
LI_API void li_log_split_lines(liServer *srv, liLogLevel log_level, guint flags, gchar *txt, const gchar *prefix);
|
||||
LI_API void li_log_split_lines_(liServer *srv, liLogLevel log_level, guint flags, gchar *txt, const gchar *fmt, ...) G_GNUC_PRINTF(5, 6);
|
||||
LI_API void li_log_split_lines_(liServer *srv, liLogLevel log_level, guint flags, gchar *txt, const gchar *fmt, ...) HEDLEY_PRINTF_FORMAT(5, 6);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@ enum {
|
|||
LI_EV_READ = 0x01,
|
||||
LI_EV_WRITE = 0x02,
|
||||
LI_EV_WAKEUP = 0x04
|
||||
};
|
||||
} HEDLEY_FLAGS;
|
||||
|
||||
typedef enum {
|
||||
LI_EVT_NONE = 0,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -156,11 +156,11 @@ LI_API void li_log_context_set(liLogContext *context, liLogMap *log_map);
|
|||
|
||||
LI_API gboolean li_log_write_direct(liServer *srv, liWorker *wrk, GString *path, GString *msg);
|
||||
/* li_log_write is used to write to the errorlog */
|
||||
LI_API gboolean li_log_write(liServer *srv, liWorker *wrk, liLogContext* context, liLogLevel log_level, guint flags, const gchar *fmt, ...) G_GNUC_PRINTF(6, 7);
|
||||
LI_API gboolean li_log_write(liServer *srv, liWorker *wrk, liLogContext* context, liLogLevel log_level, guint flags, const gchar *fmt, ...) HEDLEY_PRINTF_FORMAT(6, 7);
|
||||
|
||||
/* replaces '\r' and '\n' with '\0' */
|
||||
LI_API void li_log_split_lines(liServer *srv, liWorker *wrk, liLogContext* context, liLogLevel log_level, guint flags, gchar *txt, const gchar *prefix);
|
||||
LI_API void li_log_split_lines_(liServer *srv, liWorker *wrk, liLogContext* context, liLogLevel log_level, guint flags, gchar *txt, const gchar *fmt, ...) G_GNUC_PRINTF(7, 8);
|
||||
LI_API void li_log_split_lines_(liServer *srv, liWorker *wrk, liLogContext* context, liLogLevel log_level, guint flags, gchar *txt, const gchar *fmt, ...) HEDLEY_PRINTF_FORMAT(7, 8);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _LIGHTTPD_SETTINGS_H_
|
||||
#define _LIGHTTPD_SETTINGS_H_
|
||||
|
||||
#include <lighttpd/hedley.h>
|
||||
|
||||
/* check which OS we are compiling for */
|
||||
#if defined(__BEOS__)
|
||||
# define LIGHTY_OS_BEOS
|
||||
|
@ -163,57 +165,15 @@
|
|||
# define USE_WRITE
|
||||
#endif
|
||||
|
||||
/* Shared library support */
|
||||
#ifdef _WIN32
|
||||
#define LI_IMPORT __declspec(dllimport)
|
||||
#define LI_EXPORT __declspec(dllexport)
|
||||
#define LI_DLLLOCAL
|
||||
#define LI_DLLPUBLIC
|
||||
#else
|
||||
#define LI_IMPORT
|
||||
#ifdef GCC_HASCLASSVISIBILITY
|
||||
#define LI_EXPORT __attribute__ ((visibility("default")))
|
||||
#define LI_DLLLOCAL __attribute__ ((visibility("hidden")))
|
||||
#define LI_DLLPUBLIC __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define LI_EXPORT
|
||||
#define LI_DLLLOCAL
|
||||
#define LI_DLLPUBLIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LI_DECLARE_EXPORTS
|
||||
#define LI_API LI_EXPORT
|
||||
# define LI_API HEDLEY_PUBLIC
|
||||
#else
|
||||
#define LI_API LI_IMPORT
|
||||
#endif
|
||||
|
||||
/* Throwable classes must always be visible on GCC in all binaries */
|
||||
#ifdef _WIN32
|
||||
#define LI_EXCEPTIONAPI(api) api
|
||||
#elif defined(GCC_HASCLASSVISIBILITY)
|
||||
#define LI_EXCEPTIONAPI(api) LI_EXPORT
|
||||
#else
|
||||
#define LI_EXCEPTIONAPI(api)
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_PARAM
|
||||
#elif defined(__GNUC__)
|
||||
# define UNUSED_PARAM(x) UNUSED_ ## x __attribute__((unused))
|
||||
#elif defined(__LCLINT__)
|
||||
# define UNUSED_PARAM(x) /*@unused@*/ x
|
||||
#else
|
||||
# define UNUSED_PARAM(x) x
|
||||
# define LI_API HEDLEY_IMPORT
|
||||
#endif
|
||||
|
||||
#define UNUSED(x) ( (void)(x) )
|
||||
|
||||
#if __GNUC__
|
||||
#define INLINE static inline
|
||||
/* # define INLINE extern inline */
|
||||
#else
|
||||
# define INLINE static
|
||||
#endif
|
||||
#define INLINE static HEDLEY_INLINE
|
||||
|
||||
#ifdef PACKAGE_NO_BUILD_DATE
|
||||
# undef PACKAGE_BUILD_DATE
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#define sockread( fd, buf, bytes ) recv( fd, buf, bytes, 0 )
|
||||
|
||||
LI_EXPORT const char * inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
|
||||
LI_API const char * inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
|
||||
int inet_aton(const char *cp, struct in_addr *inp);
|
||||
#define HAVE_INET_ADDR
|
||||
#undef HAVE_INET_ATON
|
||||
|
|
|
@ -10,11 +10,11 @@ typedef enum {
|
|||
} liCounterType;
|
||||
|
||||
/* log message, print backtrace, and abort() (use LI_FATAL(msg) to call it) */
|
||||
LI_API void li_fatal(const char *filename, unsigned int line, const char *function, const char *msg) G_GNUC_NORETURN;
|
||||
LI_API void li_fatal(const char *filename, unsigned int line, const char *function, const char *msg) HEDLEY_NO_RETURN;
|
||||
/* if libunwind is available this prints a backtrace to STDERR */
|
||||
LI_API void li_print_backtrace_stderr(void);
|
||||
/* LI_FORCE_ASSERT is *always* active - in debug and release builds */
|
||||
#define LI_FORCE_ASSERT(x) do { if (G_UNLIKELY(!(x))) li_fatal(__FILE__, __LINE__, G_STRFUNC, "Assertion `" #x "' failed."); } while(0)
|
||||
#define LI_FORCE_ASSERT(x) do { if (HEDLEY_UNLIKELY(!(x))) li_fatal(__FILE__, __LINE__, G_STRFUNC, "Assertion `" #x "' failed."); } while(0)
|
||||
#define LI_FATAL(msg) li_fatal(__FILE__, __LINE__, G_STRFUNC, msg)
|
||||
|
||||
/* set O_NONBLOCK and FD_CLOEXEC */
|
||||
|
|
|
@ -72,7 +72,7 @@ struct liConfigTokenizerContext {
|
|||
GHashTable *variables;
|
||||
};
|
||||
|
||||
static liConfigToken tokenizer_error(liConfigTokenizerContext *ctx, GError **error, const char *fmt, ...) G_GNUC_PRINTF(3, 4);
|
||||
static liConfigToken tokenizer_error(liConfigTokenizerContext *ctx, GError **error, const char *fmt, ...) HEDLEY_PRINTF_FORMAT(3, 4);
|
||||
|
||||
GQuark li_angel_config_parser_error_quark(void) {
|
||||
return g_quark_from_string("li-angel-config-parser-error-quark");
|
||||
|
|
|
@ -158,7 +158,7 @@ static inline gsize mp_align_size(gsize size) {
|
|||
}
|
||||
|
||||
gsize li_mempool_align_page_size(gsize size) {
|
||||
if (G_UNLIKELY(!mp_initialized)) {
|
||||
if (HEDLEY_UNLIKELY(!mp_initialized)) {
|
||||
mempool_init();
|
||||
}
|
||||
return mp_align_size(size);
|
||||
|
@ -167,17 +167,17 @@ gsize li_mempool_align_page_size(gsize size) {
|
|||
static inline void* mp_alloc_page(gsize size) {
|
||||
void *ptr;
|
||||
# ifdef MAP_ANON
|
||||
if (G_UNLIKELY(MAP_FAILED == (ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0)))) {
|
||||
if (HEDLEY_UNLIKELY(MAP_FAILED == (ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0)))) {
|
||||
g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes with mmap", G_STRLOC, size);
|
||||
}
|
||||
# else
|
||||
if (G_UNLIKELY(NULL == (ptr = g_malloc(size)))) {
|
||||
if (HEDLEY_UNLIKELY(NULL == (ptr = g_malloc(size)))) {
|
||||
g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", G_STRLOC, size);
|
||||
}
|
||||
# endif
|
||||
|
||||
#ifdef WITH_PROFILER
|
||||
if (G_UNLIKELY(li_profiler_enabled)) {
|
||||
if (HEDLEY_UNLIKELY(li_profiler_enabled)) {
|
||||
li_profiler_hashtable_insert((gpointer)ptr, size);
|
||||
}
|
||||
#endif
|
||||
|
@ -195,7 +195,7 @@ static inline void mp_free_page(const void *ptr, gsize size) {
|
|||
# endif
|
||||
|
||||
#ifdef WITH_PROFILER
|
||||
if (G_UNLIKELY(li_profiler_enabled)) {
|
||||
if (HEDLEY_UNLIKELY(li_profiler_enabled)) {
|
||||
li_profiler_hashtable_remove((gpointer)ptr);
|
||||
}
|
||||
#endif
|
||||
|
@ -299,7 +299,7 @@ static inline void mp_mag_free(mp_magazine *mag, void *ptr) {
|
|||
if (id == mag->next - 1) mag->next--; /* if chunk was just allocated, "undo" it */
|
||||
# endif
|
||||
|
||||
if (G_UNLIKELY(0 == mag->used)) {
|
||||
if (HEDLEY_UNLIKELY(0 == mag->used)) {
|
||||
mp_free_page(mag->data, mag->count * mag->chunksize);
|
||||
mag->data = NULL;
|
||||
# ifndef MP_SEARCH_BITVECTOR
|
||||
|
@ -363,16 +363,16 @@ static inline mp_pool* mp_pools_get(gsize size) {
|
|||
mp_pool *pool;
|
||||
|
||||
pools = g_private_get(thread_pools);
|
||||
if (G_UNLIKELY(!pools)) {
|
||||
if (HEDLEY_UNLIKELY(!pools)) {
|
||||
pools = g_slice_new0(mp_pools);
|
||||
g_private_set(thread_pools, pools);
|
||||
}
|
||||
|
||||
for (iter = pools->queue.head; iter; iter = iter->next) {
|
||||
pool = iter->data;
|
||||
if (G_LIKELY(pool->chunksize == size)) {
|
||||
if (HEDLEY_LIKELY(pool->chunksize == size)) {
|
||||
goto done;
|
||||
} else if (G_UNLIKELY(pool->chunksize > size)) {
|
||||
} else if (HEDLEY_UNLIKELY(pool->chunksize > size)) {
|
||||
pool = mp_pool_new(size);
|
||||
_queue_insert_before(&pools->queue, iter, &pool->pools_list);
|
||||
goto done;
|
||||
|
@ -392,15 +392,15 @@ liMempoolPtr li_mempool_alloc(gsize size) {
|
|||
mp_magazine *mag;
|
||||
guint i;
|
||||
|
||||
if (G_UNLIKELY(!mp_initialized)) {
|
||||
if (HEDLEY_UNLIKELY(!mp_initialized)) {
|
||||
mempool_init();
|
||||
}
|
||||
|
||||
size = mp_align_size(size);
|
||||
|
||||
/* mp_alloc_page fallback */
|
||||
if (G_UNLIKELY(size > MP_MAX_ALLOC_SIZE/MP_MIN_ALLOC_COUNT)) {
|
||||
if (G_UNLIKELY(NULL == (ptr.data = mp_alloc_page(size)))) {
|
||||
if (HEDLEY_UNLIKELY(size > MP_MAX_ALLOC_SIZE/MP_MIN_ALLOC_COUNT)) {
|
||||
if (HEDLEY_UNLIKELY(NULL == (ptr.data = mp_alloc_page(size)))) {
|
||||
g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", G_STRLOC, size);
|
||||
}
|
||||
return ptr;
|
||||
|
@ -411,12 +411,12 @@ liMempoolPtr li_mempool_alloc(gsize size) {
|
|||
/* Try to lock a unlocked magazine if possible; creating new magazines is allowed
|
||||
* (new ones can't be locked as only the current thread knows this magazine)
|
||||
* Spinlock the first magazine if first strategy failed */
|
||||
if (G_LIKELY(pool->magazines[0])) {
|
||||
if (HEDLEY_LIKELY(pool->magazines[0])) {
|
||||
/* at least one magazine available */
|
||||
for (i = 0; i < MP_MAX_MAGAZINES; i++) {
|
||||
mag = pool->magazines[i];
|
||||
if (!mag) break;
|
||||
if (G_LIKELY(MP_TRYLOCK(mag->mutex))) {
|
||||
if (HEDLEY_LIKELY(MP_TRYLOCK(mag->mutex))) {
|
||||
goto found_mag;
|
||||
}
|
||||
}
|
||||
|
@ -436,9 +436,9 @@ found_mag:
|
|||
mp_mag_acquire(mag); /* keep track of chunk count */
|
||||
|
||||
# ifndef MP_SEARCH_BITVECTOR
|
||||
if (G_UNLIKELY(mag->next == mag->count)) {
|
||||
if (HEDLEY_UNLIKELY(mag->next == mag->count)) {
|
||||
# else
|
||||
if (G_UNLIKELY(mag->used == mag->count)) {
|
||||
if (HEDLEY_UNLIKELY(mag->used == mag->count)) {
|
||||
# endif
|
||||
/* full magazine; remove from pool */
|
||||
guint j;
|
||||
|
@ -468,7 +468,7 @@ void li_mempool_free(liMempoolPtr ptr, gsize size) {
|
|||
size = mp_align_size(size);
|
||||
|
||||
/* mp_alloc_page fallback */
|
||||
if (G_UNLIKELY(size > MP_MAX_ALLOC_SIZE/MP_MIN_ALLOC_COUNT)) {
|
||||
if (HEDLEY_UNLIKELY(size > MP_MAX_ALLOC_SIZE/MP_MIN_ALLOC_COUNT)) {
|
||||
mp_free_page(ptr.data, size);
|
||||
return;
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void li_mempool_cleanup(void) {
|
|||
/* "Force" thread-private cleanup */
|
||||
mp_pools *pools;
|
||||
|
||||
if (G_UNLIKELY(!mp_initialized)) {
|
||||
if (HEDLEY_UNLIKELY(!mp_initialized)) {
|
||||
mempool_init();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ void li_waitqueue_update(liWaitQueue *queue) {
|
|||
li_tstamp repeat;
|
||||
li_tstamp now = li_event_now(li_event_get_loop(&queue->timer));
|
||||
|
||||
if (G_LIKELY(queue->head)) {
|
||||
if (HEDLEY_LIKELY(queue->head)) {
|
||||
repeat = queue->head->ts + queue->delay - now;
|
||||
|
||||
if (repeat < 0.05) repeat = 0.05;
|
||||
|
@ -85,7 +85,7 @@ void li_waitqueue_push(liWaitQueue *queue, liWaitQueueElem *elem) {
|
|||
queue->tail = elem;
|
||||
}
|
||||
|
||||
if (G_UNLIKELY(!li_event_active(&queue->timer)))
|
||||
if (HEDLEY_UNLIKELY(!li_event_active(&queue->timer)))
|
||||
li_event_timer_once(&queue->timer, queue->delay);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ void li_waitqueue_remove(liWaitQueue *queue, liWaitQueueElem *elem) {
|
|||
elem->queued = FALSE;
|
||||
queue->length--;
|
||||
|
||||
if (G_UNLIKELY(!queue->head))
|
||||
if (HEDLEY_UNLIKELY(!queue->head))
|
||||
li_event_stop(&queue->timer);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ struct liConditionTree {
|
|||
liConditionTree *left, *right;
|
||||
};
|
||||
|
||||
static liConfigToken tokenizer_error(liConfigTokenizerContext *ctx, GError **error, const char *fmt, ...) G_GNUC_PRINTF(3, 4);
|
||||
static liConfigToken tokenizer_error(liConfigTokenizerContext *ctx, GError **error, const char *fmt, ...) HEDLEY_PRINTF_FORMAT(3, 4);
|
||||
|
||||
GQuark li_config_error_quark(void) {
|
||||
return g_quark_from_string("li-config-error-quark");
|
||||
|
|
|
@ -267,7 +267,7 @@ gboolean li_http_header_tokenizer_next(liHttpHeaderTokenizer *tokenizer, GString
|
|||
++pos;
|
||||
if (pos >= len) return FALSE; /* no character after backslash */
|
||||
/* append whatever comes */
|
||||
/* fallthrough */
|
||||
HEDLEY_FALL_THROUGH;
|
||||
default:
|
||||
g_string_append_c(token, str[pos]);
|
||||
break;
|
||||
|
@ -285,7 +285,7 @@ quoted:
|
|||
++pos;
|
||||
if (pos >= len) return FALSE; /* no character after backslash */
|
||||
/* append whatever comes */
|
||||
/* fallthrough */
|
||||
HEDLEY_FALL_THROUGH;
|
||||
default:
|
||||
g_string_append_c(token, str[pos]);
|
||||
break;
|
||||
|
|
|
@ -207,7 +207,7 @@ gboolean li_log_write_direct(liServer *srv, liWorker *wrk, GString *path, GStrin
|
|||
log_entry->queue_link.next = NULL;
|
||||
log_entry->queue_link.prev = NULL;
|
||||
|
||||
if (G_LIKELY(wrk)) {
|
||||
if (HEDLEY_LIKELY(wrk)) {
|
||||
/* push onto local worker log queue */
|
||||
g_queue_push_tail_link(&wrk->logs.log_queue, &log_entry->queue_link);
|
||||
} else {
|
||||
|
@ -273,7 +273,7 @@ gboolean li_log_write(liServer *srv, liWorker *wrk, liLogContext *context, liLog
|
|||
log_entry->queue_link.next = NULL;
|
||||
log_entry->queue_link.prev = NULL;
|
||||
|
||||
if (G_LIKELY(wrk)) {
|
||||
if (HEDLEY_LIKELY(wrk)) {
|
||||
/* push onto local worker log queue */
|
||||
g_queue_push_tail_link(&wrk->logs.log_queue, &log_entry->queue_link);
|
||||
} else {
|
||||
|
|
|
@ -98,7 +98,7 @@ liNetworkStatus li_network_read(int fd, liChunkQueue *cq, goffset read_max, liBu
|
|||
if (NULL != buffer) {
|
||||
if (buf != NULL) {
|
||||
/* use last buffer as *buffer; they should be the same anyway */
|
||||
if (G_UNLIKELY(buf != *buffer)) {
|
||||
if (HEDLEY_UNLIKELY(buf != *buffer)) {
|
||||
li_buffer_acquire(buf);
|
||||
li_buffer_release(*buffer);
|
||||
*buffer = buf;
|
||||
|
|
|
@ -240,7 +240,7 @@ void li_pattern_free(liPattern *pattern) {
|
|||
part = &g_array_index(arr, liPatternPart, i);
|
||||
switch (part->type) {
|
||||
case PATTERN_STRING: g_string_free(part->data.str, TRUE); break;
|
||||
case PATTERN_VAR_ENCODED: /* fall through */
|
||||
case PATTERN_VAR_ENCODED: HEDLEY_FALL_THROUGH;
|
||||
case PATTERN_VAR: li_condition_lvalue_release(part->data.lvalue); break;
|
||||
default: break;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ void li_pattern_eval(liVRequest *vr, GString *dest, liPattern *pattern, liPatter
|
|||
break;
|
||||
case PATTERN_VAR_ENCODED:
|
||||
encoded = TRUE;
|
||||
/* fall through */
|
||||
HEDLEY_FALL_THROUGH;
|
||||
case PATTERN_VAR:
|
||||
if (vr == NULL) continue;
|
||||
|
||||
|
@ -305,7 +305,7 @@ void li_pattern_array_cb(GString *pattern_result, guint from, guint to, gpointer
|
|||
|
||||
if (NULL == a || 0 == a->len) return;
|
||||
|
||||
if (G_LIKELY(from <= to)) {
|
||||
if (HEDLEY_LIKELY(from <= to)) {
|
||||
to = MIN(to, a->len - 1);
|
||||
for (i = from; i <= to; i++) {
|
||||
GString *str = g_array_index(a, GString*, i);
|
||||
|
@ -331,7 +331,7 @@ void li_pattern_regex_cb(GString *pattern_result, guint from, guint to, gpointer
|
|||
|
||||
if (NULL == match_info) return;
|
||||
|
||||
if (G_LIKELY(from <= to)) {
|
||||
if (HEDLEY_LIKELY(from <= to)) {
|
||||
to = MIN(to, G_MAXINT);
|
||||
for (i = from; i <= to; i++) {
|
||||
if (g_match_info_fetch_pos(match_info, (gint) i, &start_pos, &end_pos)) {
|
||||
|
|
|
@ -103,19 +103,19 @@ static void throttle_pool_rearm(liWorker *wrk, liThrottlePool *pool, guint now)
|
|||
guint last = g_atomic_int_get((gint*) &pool->last_rearm);
|
||||
guint time_diff = now - last;
|
||||
|
||||
if (G_UNLIKELY(time_diff >= LI_THROTTLE_GRANULARITY)) {
|
||||
if (HEDLEY_UNLIKELY(time_diff >= LI_THROTTLE_GRANULARITY)) {
|
||||
g_mutex_lock(pool->rearm_mutex);
|
||||
/* check again */
|
||||
last = g_atomic_int_get((gint*) &pool->last_rearm);
|
||||
time_diff = now - last;
|
||||
if (G_LIKELY(time_diff >= LI_THROTTLE_GRANULARITY)) {
|
||||
if (HEDLEY_LIKELY(time_diff >= LI_THROTTLE_GRANULARITY)) {
|
||||
S_throttle_pool_rearm_workers(pool, wrk->srv->worker_count, time_diff);
|
||||
g_atomic_int_set((gint*) &pool->last_rearm, now);
|
||||
}
|
||||
g_mutex_unlock(pool->rearm_mutex);
|
||||
}
|
||||
|
||||
if (G_UNLIKELY(wpool->last_rearm < last)) {
|
||||
if (HEDLEY_UNLIKELY(wpool->last_rearm < last)) {
|
||||
/* distribute wpool->magazine */
|
||||
GList *lnk;
|
||||
guint connections = wpool->connections;
|
||||
|
|
|
@ -26,7 +26,7 @@ enum FCGI_Type {
|
|||
|
||||
enum FCGI_Flags {
|
||||
FCGI_KEEP_CONN = 1
|
||||
};
|
||||
} HEDLEY_FLAGS;
|
||||
|
||||
enum FCGI_Role {
|
||||
FCGI_RESPONDER = 1,
|
||||
|
|
|
@ -314,7 +314,7 @@ static void do_gnutls_read(liGnuTLSFilter *f) {
|
|||
|
||||
if (buf != NULL) {
|
||||
/* use last buffer as raw_in_buffer; they should be the same anyway */
|
||||
if (G_UNLIKELY(buf != f->raw_in_buffer)) {
|
||||
if (HEDLEY_UNLIKELY(buf != f->raw_in_buffer)) {
|
||||
li_buffer_acquire(buf);
|
||||
li_buffer_release(f->raw_in_buffer);
|
||||
f->raw_in_buffer = buf;
|
||||
|
@ -427,7 +427,7 @@ static void do_gnutls_write(liGnuTLSFilter *f) {
|
|||
_ERROR(f->srv, f->wrk, f->log_context, "Couldn't read data from chunkqueue: %s", err->message);
|
||||
g_error_free(err);
|
||||
}
|
||||
/* fall through */
|
||||
HEDLEY_FALL_THROUGH;
|
||||
default:
|
||||
f_abort_gnutls(f);
|
||||
goto out;
|
||||
|
|
|
@ -186,9 +186,9 @@ static liAction* lua_handler_create(liServer *srv, liWorker *wrk, liPlugin* p, l
|
|||
v_filename = val;
|
||||
} else if (LI_VALUE_LIST == li_value_type(val)) {
|
||||
switch (li_value_list_len(val)) {
|
||||
case 3: v_args = li_value_list_at(val, 2); /* fall through */
|
||||
case 2: v_options = li_value_list_at(val, 1); /* fall through */
|
||||
case 1: v_filename = li_value_list_at(val, 0); /* fall through */
|
||||
case 3: v_args = li_value_list_at(val, 2); HEDLEY_FALL_THROUGH;
|
||||
case 2: v_options = li_value_list_at(val, 1); HEDLEY_FALL_THROUGH;
|
||||
case 1: v_filename = li_value_list_at(val, 0); HEDLEY_FALL_THROUGH;
|
||||
case 0: break;
|
||||
default:
|
||||
ERROR(srv, "%s", "lua.handler expects at most 3 arguments");
|
||||
|
@ -525,9 +525,9 @@ static gboolean lua_plugin(liServer *srv, liPlugin *p, liValue *val, gpointer us
|
|||
v_filename = val;
|
||||
} else if (LI_VALUE_LIST == li_value_type(val)) {
|
||||
switch (li_value_list_len(val)) {
|
||||
case 3: v_args = li_value_list_at(val, 2); /* fall through */
|
||||
case 2: v_options = li_value_list_at(val, 1); /* fall through */
|
||||
case 1: v_filename = li_value_list_at(val, 0); /* fall through */
|
||||
case 3: v_args = li_value_list_at(val, 2); HEDLEY_FALL_THROUGH;
|
||||
case 2: v_options = li_value_list_at(val, 1); HEDLEY_FALL_THROUGH;
|
||||
case 1: v_filename = li_value_list_at(val, 0); HEDLEY_FALL_THROUGH;
|
||||
case 0: break;
|
||||
default:
|
||||
ERROR(srv, "%s", "lua.plugin expects at most 3 arguments");
|
||||
|
|
|
@ -55,7 +55,7 @@ enum {
|
|||
SE_CLIENT_CERT = 0x2,
|
||||
SE_SERVER = 0x4,
|
||||
SE_SERVER_CERT = 0x8
|
||||
};
|
||||
} HEDLEY_FLAGS;
|
||||
|
||||
static openssl_context* mod_openssl_context_new(void) {
|
||||
openssl_context *ctx = g_slice_new0(openssl_context);
|
||||
|
|
|
@ -431,7 +431,7 @@ static void do_ssl_read(liOpenSSLFilter *f) {
|
|||
|
||||
if (buf != NULL) {
|
||||
/* use last buffer as raw_in_buffer; they should be the same anyway */
|
||||
if (G_UNLIKELY(buf != f->raw_in_buffer)) {
|
||||
if (HEDLEY_UNLIKELY(buf != f->raw_in_buffer)) {
|
||||
li_buffer_acquire(buf);
|
||||
li_buffer_release(f->raw_in_buffer);
|
||||
f->raw_in_buffer = buf;
|
||||
|
@ -544,7 +544,7 @@ static void do_ssl_write(liOpenSSLFilter *f) {
|
|||
_ERROR(f->srv, f->wrk, f->log_context, "Couldn't read data from chunkqueue: %s", err->message);
|
||||
g_error_free(err);
|
||||
}
|
||||
/* fall through */
|
||||
HEDLEY_FALL_THROUGH;
|
||||
default:
|
||||
f_abort_ssl(f);
|
||||
goto out;
|
||||
|
|
Loading…
Reference in New Issue