summaryrefslogtreecommitdiff
path: root/data/lighttpd/lighttpd-1.4.53/src/status_counter.h
blob: cdbd5c1376841ca4c433cb2723dfb0e03aaf26cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef _STATUS_COUNTER_H_
#define _STATUS_COUNTER_H_
#include "first.h"

#include "base_decls.h"

static inline
int *status_counter_get_counter(server *srv, const char *s, size_t len);
static inline
void status_counter_inc(server *srv, const char *s, size_t len);
static inline
void status_counter_dec(server *srv, const char *s, size_t len);
static inline
void status_counter_set(server *srv, const char *s, size_t len, int val);

/* inline status counter routines */

#include "base.h"       /* (srv->status) */
#include "array.h"

static inline
int *status_counter_get_counter(server *srv, const char *s, size_t len) {
    return array_get_int_ptr(srv->status, s, len);
}

static inline
void status_counter_inc(server *srv, const char *s, size_t len) {
    ++(*array_get_int_ptr(srv->status, s, len));
}

static inline
void status_counter_dec(server *srv, const char *s, size_t len) {
    --(*array_get_int_ptr(srv->status, s, len));
}

static inline
void status_counter_set(server *srv, const char *s, size_t len, int val) {
    *array_get_int_ptr(srv->status, s, len) = val;
}


#endif