}
bool journal_field_valid(const char *p, size_t l, bool allow_protected) {
- const char *a;
-
/* We kinda enforce POSIX syntax recommendations for
environment variables here, but make a couple of additional
requirements.
return false;
/* Only allow A-Z0-9 and '_' */
- for (a = p; a < p + l; a++)
+ for (const char *a = p; a < p + l; a++)
if ((*a < 'A' || *a > 'Z') &&
(*a < '0' || *a > '9') &&
*a != '_')
}
static int journal_file_link_entry(JournalFile *f, Object *o, uint64_t offset) {
- uint64_t n, i;
+ uint64_t n;
int r;
assert(f);
/* Link up the items */
n = journal_file_entry_n_items(o);
- for (i = 0; i < n; i++) {
+ for (uint64_t i = 0; i < n; i++) {
r = journal_file_link_entry_item(f, o, offset, i);
if (r < 0)
return r;
uint64_t *seqnum,
Object **ret, uint64_t *ret_offset) {
- unsigned i;
EntryItem *items;
int r;
uint64_t xor_hash = 0;
/* alloca() can't take 0, hence let's allocate at least one */
items = newa(EntryItem, MAX(1u, n_iovec));
- for (i = 0; i < n_iovec; i++) {
+ for (unsigned i = 0; i < n_iovec; i++) {
uint64_t p;
Object *o;
}
int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint64_t p) {
- uint64_t i, n;
- uint64_t q, xor_hash = 0;
- int r;
- EntryItem *items;
- dual_timestamp ts;
+ uint64_t q, n, xor_hash = 0;
const sd_id128_t *boot_id;
+ dual_timestamp ts;
+ EntryItem *items;
+ int r;
assert(from);
assert(to);
/* alloca() can't take 0, hence let's allocate at least one */
items = newa(EntryItem, MAX(1u, n));
- for (i = 0; i < n; i++) {
+ for (uint64_t i = 0; i < n; i++) {
uint64_t l, h;
le64_t le_hash;
size_t t;