cppcheck style

This commit is contained in:
Enno Rehling 2018-12-02 11:13:58 +01:00
parent cb7d2e9fcb
commit 83556f8010
4 changed files with 5 additions and 7 deletions

View File

@ -121,7 +121,7 @@ static int read_keyval_orig(gamedata *data, int *keys, int n) {
#endif
static int a_readkeys(variant *var, void *owner, gamedata *data) {
int i, n, ksn, *keys;
int n, ksn, *keys;
READ_INT(data->store, &n);
assert(n < 4096 && n >= 0);
@ -155,7 +155,7 @@ static int a_readkeys(variant *var, void *owner, gamedata *data) {
}
keys[0] = n;
if (data->version < SORTKEYS_VERSION) {
int e = 1;
int i, e = 1;
for (i = 1; i != n; ++i) {
int k = keys[i * 2 + 1];
int v = keys[i * 2 + 2];

View File

@ -48,13 +48,12 @@ static int read_seenspells(variant *var, void *owner, struct gamedata *data)
{
selist *ql = NULL;
storage *store = data->store;
spell *sp = 0;
char token[32];
UNUSED_ARG(owner);
READ_TOK(store, token, sizeof(token));
while (token[0]) {
sp = find_spell(token);
spell *sp = find_spell(token);
if (!sp) {
log_info("read_seenspells: could not find spell '%s'\n", token);
return AT_READ_FAIL;

View File

@ -82,7 +82,7 @@ void autostudy_run(scholar scholars[], int nscholars)
int ti = 0;
while (ti != nscholars) {
skill_t sk = scholars[ti].sk;
int t, s, se, ts = 0, tt = 0, si = ti;
int t, se, ts = 0, tt = 0, si = ti;
for (se = ti; se != nscholars && scholars[se].sk == sk; ++se) {
int mint;
ts += scholars[se].u->number; /* count total scholars */
@ -108,7 +108,7 @@ void autostudy_run(scholar scholars[], int nscholars)
}
else {
/* invariant: unit ti can still teach i students */
int i = scholars[ti].u->number * STUDENTS_PER_TEACHER;
int s, i = scholars[ti].u->number * STUDENTS_PER_TEACHER;
/* invariant: unit si has n students that can still be taught */
int n = scholars[si].u->number;
for (t = ti, s = si; t != si && s != se; ) {

View File

@ -22,7 +22,6 @@
#include "kernel/skills.h"
#include "kernel/types.h"
#include <kernel/building.h>
#include <kernel/config.h>
#include <kernel/curse.h>
#include "kernel/equipment.h"
#include <kernel/faction.h>