summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/catalog.h2
-rw-r--r--src/journal/fsprg.c2
-rw-r--r--src/journal/fsprg.h10
-rw-r--r--src/journal/journal-file.c2
-rw-r--r--src/journal/journal-file.h6
-rw-r--r--src/journal/journal-send.c2
-rw-r--r--src/journal/journald-rate-limit.c2
-rw-r--r--src/journal/journald-server.h8
-rw-r--r--src/journal/journald-syslog.h2
-rw-r--r--src/journal/lookup3.h8
-rw-r--r--src/journal/mmap-cache.c2
-rw-r--r--src/journal/sd-journal.c2
12 files changed, 26 insertions, 22 deletions
diff --git a/src/journal/catalog.h b/src/journal/catalog.h
index 89f8f93d03..24a2d0b553 100644
--- a/src/journal/catalog.h
+++ b/src/journal/catalog.h
@@ -29,7 +29,7 @@
int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path);
unsigned catalog_hash_func(const void *p);
-int catalog_compare_func(const void *a, const void *b);
+int catalog_compare_func(const void *a, const void *b) _pure_;
int catalog_update(const char* database, const char* root, const char* const* dirs);
int catalog_get(const char* database, sd_id128_t id, char **data);
int catalog_list(FILE *f, const char* database, bool oneline);
diff --git a/src/journal/fsprg.c b/src/journal/fsprg.c
index 2190b7c796..6817a629c8 100644
--- a/src/journal/fsprg.c
+++ b/src/journal/fsprg.c
@@ -74,7 +74,7 @@ static void uint64_export(void *buf, size_t buflen, uint64_t x) {
((uint8_t*) buf)[7] = (x >> 0) & 0xff;
}
-static uint64_t uint64_import(const void *buf, size_t buflen) {
+_pure_ static uint64_t uint64_import(const void *buf, size_t buflen) {
assert(buflen == 8);
return
(uint64_t)(((uint8_t*) buf)[0]) << 56 |
diff --git a/src/journal/fsprg.h b/src/journal/fsprg.h
index 306ef18d73..150d034828 100644
--- a/src/journal/fsprg.h
+++ b/src/journal/fsprg.h
@@ -28,6 +28,8 @@
#include <sys/types.h>
#include <inttypes.h>
+#include "macro.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -35,9 +37,9 @@ extern "C" {
#define FSPRG_RECOMMENDED_SECPAR 1536
#define FSPRG_RECOMMENDED_SEEDLEN (96/8)
-size_t FSPRG_mskinbytes(unsigned secpar);
-size_t FSPRG_mpkinbytes(unsigned secpar);
-size_t FSPRG_stateinbytes(unsigned secpar);
+size_t FSPRG_mskinbytes(unsigned secpar) _const_;
+size_t FSPRG_mpkinbytes(unsigned secpar) _const_;
+size_t FSPRG_stateinbytes(unsigned secpar) _const_;
/* Setup msk and mpk. Providing seed != NULL makes this algorithm deterministic. */
void FSPRG_GenMK(void *msk, void *mpk, const void *seed, size_t seedlen, unsigned secpar);
@@ -50,7 +52,7 @@ void FSPRG_GenState0(void *state, const void *mpk, const void *seed, size_t seed
void FSPRG_Evolve(void *state);
-uint64_t FSPRG_GetEpoch(const void *state);
+uint64_t FSPRG_GetEpoch(const void *state) _pure_;
/* Seek to any arbitrary state (by providing msk together with seed from GenState0). */
void FSPRG_Seek(void *state, uint64_t epoch, const void *msk, const void *seed, size_t seedlen);
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index a44e126c0e..876224dc9f 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1712,7 +1712,7 @@ found:
return 1;
}
-static int test_object_offset(JournalFile *f, uint64_t p, uint64_t needle) {
+_pure_ static int test_object_offset(JournalFile *f, uint64_t p, uint64_t needle) {
assert(f);
assert(p > 0);
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index 0eab5017d7..7b1cd42854 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -150,9 +150,9 @@ static inline bool VALID_EPOCH(uint64_t u) {
int journal_file_move_to_object(JournalFile *f, int type, uint64_t offset, Object **ret);
-uint64_t journal_file_entry_n_items(Object *o);
-uint64_t journal_file_entry_array_n_items(Object *o);
-uint64_t journal_file_hash_table_n_items(Object *o);
+uint64_t journal_file_entry_n_items(Object *o) _pure_;
+uint64_t journal_file_entry_array_n_items(Object *o) _pure_;
+uint64_t journal_file_hash_table_n_items(Object *o) _pure_;
int journal_file_append_object(JournalFile *f, int type, uint64_t size, Object **ret, uint64_t *offset);
int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const struct iovec iovec[], unsigned n_iovec, uint64_t *seqno, Object **ret, uint64_t *offset);
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index 4b9109a3c8..14c437da78 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -111,7 +111,7 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) {
return sd_journal_sendv(iov, 2);
}
-static int fill_iovec_sprintf(const char *format, va_list ap, int extra, struct iovec **_iov) {
+_printf_attr_(1, 0) static int fill_iovec_sprintf(const char *format, va_list ap, int extra, struct iovec **_iov) {
PROTECT_ERRNO;
int r, n = 0, i = 0, j;
struct iovec *iov = NULL;
diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c
index da3aed64ea..32e35a926d 100644
--- a/src/journal/journald-rate-limit.c
+++ b/src/journal/journald-rate-limit.c
@@ -115,7 +115,7 @@ void journal_rate_limit_free(JournalRateLimit *r) {
free(r);
}
-static bool journal_rate_limit_group_expired(JournalRateLimitGroup *g, usec_t ts) {
+_pure_ static bool journal_rate_limit_group_expired(JournalRateLimitGroup *g, usec_t ts) {
unsigned i;
assert(g);
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h
index 86f7145292..129f7e8ab4 100644
--- a/src/journal/journald-server.h
+++ b/src/journal/journald-server.h
@@ -137,13 +137,13 @@ const struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned len
int config_parse_storage(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-const char *storage_to_string(Storage s);
-Storage storage_from_string(const char *s);
+const char *storage_to_string(Storage s) _const_;
+Storage storage_from_string(const char *s) _pure_;
int config_parse_split_mode(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-const char *split_mode_to_string(SplitMode s);
-SplitMode split_mode_from_string(const char *s);
+const char *split_mode_to_string(SplitMode s) _const_;
+SplitMode split_mode_from_string(const char *s) _pure_;
void server_fix_perms(Server *s, JournalFile *f, uid_t uid);
bool shall_try_append_again(JournalFile *f, int r);
diff --git a/src/journal/journald-syslog.h b/src/journal/journald-syslog.h
index 7ff215b524..324b70eef0 100644
--- a/src/journal/journald-syslog.h
+++ b/src/journal/journald-syslog.h
@@ -23,7 +23,7 @@
#include "journald-server.h"
-int syslog_fixup_facility(int priority);
+int syslog_fixup_facility(int priority) _const_;
void syslog_parse_priority(char **p, int *priority);
size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid);
diff --git a/src/journal/lookup3.h b/src/journal/lookup3.h
index 502b42c209..3224473a6a 100644
--- a/src/journal/lookup3.h
+++ b/src/journal/lookup3.h
@@ -5,13 +5,15 @@
#include <inttypes.h>
#include <sys/types.h>
-uint32_t jenkins_hashword(const uint32_t *k, size_t length, uint32_t initval);
+#include "macro.h"
+
+uint32_t jenkins_hashword(const uint32_t *k, size_t length, uint32_t initval) _pure_;
void jenkins_hashword2(const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb);
-uint32_t jenkins_hashlittle(const void *key, size_t length, uint32_t initval);
+uint32_t jenkins_hashlittle(const void *key, size_t length, uint32_t initval) _pure_;
void jenkins_hashlittle2(const void *key, size_t length, uint32_t *pc, uint32_t *pb);
-uint32_t jenkins_hashbig(const void *key, size_t length, uint32_t initval);
+uint32_t jenkins_hashbig(const void *key, size_t length, uint32_t initval) _pure_;
static inline uint64_t hash64(const void *data, size_t length) {
uint32_t a = 0, b = 0;
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 251aefe121..54bf1148e1 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -134,7 +134,7 @@ static void window_free(Window *w) {
free(w);
}
-static bool window_matches(Window *w, int fd, int prot, uint64_t offset, size_t size) {
+_pure_ static bool window_matches(Window *w, int fd, int prot, uint64_t offset, size_t size) {
assert(w);
assert(fd >= 0);
assert(size > 0);
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 15239b5688..d81e4ddfa9 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -498,7 +498,7 @@ static int compare_entry_order(JournalFile *af, Object *_ao,
return 0;
}
-static int compare_with_location(JournalFile *af, Object *ao, Location *l) {
+_pure_ static int compare_with_location(JournalFile *af, Object *ao, Location *l) {
uint64_t a;
assert(af);