Coding style: add spaces in load-git.c

Add spaces before and after multiplication and addition operators.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-07-25 00:26:51 +02:00 committed by Dirk Hohndel
parent 3fe80bfd79
commit 891d21b34e

View file

@ -52,7 +52,7 @@ static char *get_utf8(struct membuffer *b)
if (!len) if (!len)
return NULL; return NULL;
res = malloc(len+1); res = malloc(len + 1);
if (res) { if (res) {
memcpy(res, b->buffer, len); memcpy(res, b->buffer, len);
res[len] = 0; res[len] = 0;
@ -70,21 +70,21 @@ static temperature_t get_temperature(const char *line)
static depth_t get_depth(const char *line) static depth_t get_depth(const char *line)
{ {
depth_t d; depth_t d;
d.mm = lrint(1000*ascii_strtod(line, NULL)); d.mm = lrint(1000 * ascii_strtod(line, NULL));
return d; return d;
} }
static volume_t get_volume(const char *line) static volume_t get_volume(const char *line)
{ {
volume_t v; volume_t v;
v.mliter = lrint(1000*ascii_strtod(line, NULL)); v.mliter = lrint(1000 * ascii_strtod(line, NULL));
return v; return v;
} }
static weight_t get_weight(const char *line) static weight_t get_weight(const char *line)
{ {
weight_t w; weight_t w;
w.grams = lrint(1000*ascii_strtod(line, NULL)); w.grams = lrint(1000 * ascii_strtod(line, NULL));
return w; return w;
} }
@ -98,13 +98,13 @@ static pressure_t get_airpressure(const char *line)
static pressure_t get_pressure(const char *line) static pressure_t get_pressure(const char *line)
{ {
pressure_t p; pressure_t p;
p.mbar = lrint(1000*ascii_strtod(line, NULL)); p.mbar = lrint(1000 * ascii_strtod(line, NULL));
return p; return p;
} }
static int get_salinity(const char *line) static int get_salinity(const char *line)
{ {
return lrint(10*ascii_strtod(line, NULL)); return lrint(10 * ascii_strtod(line, NULL));
} }
static fraction_t get_fraction(const char *line) static fraction_t get_fraction(const char *line)
@ -147,7 +147,7 @@ static duration_t get_duration(const char *line)
int m = 0, s = 0; int m = 0, s = 0;
duration_t d; duration_t d;
sscanf(line, "%d:%d", &m, &s); sscanf(line, "%d:%d", &m, &s);
d.seconds = m*60+s; d.seconds = m * 60 + s;
return d; return d;
} }
@ -463,7 +463,7 @@ static int match_action(char *line, struct membuffer *str, void *data,
low = 0; low = 0;
high = nr_action; high = nr_action;
while (low < high) { while (low < high) {
unsigned mid = (low+high)/2; unsigned mid = (low + high)/2;
struct keyword_action *a = action + mid; struct keyword_action *a = action + mid;
int cmp = strcmp(line, a->keyword); int cmp = strcmp(line, a->keyword);
if (!cmp) { // attribute found: if (!cmp) { // attribute found:
@ -473,7 +473,7 @@ static int match_action(char *line, struct membuffer *str, void *data,
if (cmp < 0) if (cmp < 0)
high = mid; high = mid;
else else
low = mid+1; low = mid + 1;
} }
report_error("Unmatched action '%s'", line); report_error("Unmatched action '%s'", line);
return -1; return -1;
@ -573,13 +573,13 @@ static char *parse_sample_unit(struct sample *sample, double val, char *unit)
/* The cylinder pressure may also be of the form '123.0bar:4' to indicate sensor */ /* The cylinder pressure may also be of the form '123.0bar:4' to indicate sensor */
switch (*unit) { switch (*unit) {
case 'm': case 'm':
sample->depth.mm = lrint(1000*val); sample->depth.mm = lrint(1000 * val);
break; break;
case 'b': case 'b':
sensor = sample->sensor[0]; sensor = sample->sensor[0];
if (end > unit+4 && unit[3] == ':') if (end > unit + 4 && unit[3] == ':')
sensor = atoi(unit+4); sensor = atoi(unit + 4);
add_sample_pressure(sample, sensor, lrint(1000*val)); add_sample_pressure(sample, sensor, lrint(1000 * val));
break; break;
default: default:
sample->temperature.mkelvin = C_to_mkelvin(val); sample->temperature.mkelvin = C_to_mkelvin(val);
@ -628,8 +628,8 @@ static void sample_parser(char *line, struct git_parser_state *state)
m = strtol(line, &line, 10); m = strtol(line, &line, 10);
if (*line == ':') if (*line == ':')
s = strtol(line+1, &line, 10); s = strtol(line + 1, &line, 10);
sample->time.seconds = m*60+s; sample->time.seconds = m * 60 + s;
for (;;) { for (;;) {
char c; char c;
@ -729,7 +729,7 @@ static void parse_event_keyvalue(void *_event, const char *key, const char *valu
event->value = get_divemode(value); event->value = get_divemode(value);
} else if (!strcmp(key, "cylinder")) { } else if (!strcmp(key, "cylinder")) {
/* NOTE! We add one here as a marker that "yes, we got a cylinder index" */ /* NOTE! We add one here as a marker that "yes, we got a cylinder index" */
event->gas.index = 1+get_index(value); event->gas.index = 1 + get_index(value);
} else if (!strcmp(key, "o2")) { } else if (!strcmp(key, "o2")) {
event->gas.mix.o2 = get_fraction(value); event->gas.mix.o2 = get_fraction(value);
} else if (!strcmp(key, "he")) { } else if (!strcmp(key, "he")) {
@ -771,8 +771,8 @@ static void parse_dc_event(char *line, struct membuffer *str, struct git_parser_
m = strtol(line, &line, 10); m = strtol(line, &line, 10);
if (*line == ':') if (*line == ':')
s = strtol(line+1, &line, 10); s = strtol(line + 1, &line, 10);
event.time.seconds = m*60+s; event.time.seconds = m * 60 + s;
for (;;) { for (;;) {
char c; char c;
@ -896,7 +896,7 @@ static void parse_divecomputerid_keyvalue(void *_cid, const char *key, const cha
if (*value == '"') { if (*value == '"') {
value = cid->cstr; value = cid->cstr;
cid->cstr += strlen(cid->cstr)+1; cid->cstr += strlen(cid->cstr) + 1;
} }
if (!strcmp(key, "deviceid")) { if (!strcmp(key, "deviceid")) {
cid->deviceid = get_hex(value); cid->deviceid = get_hex(value);
@ -1129,7 +1129,7 @@ static unsigned parse_one_line(const char *buf, unsigned size, line_fn_t *fn, st
{ {
const char *end = buf + size; const char *end = buf + size;
const char *p = buf; const char *p = buf;
char line[MAXLINE+1]; char line[MAXLINE + 1];
int off = 0; int off = 0;
while (p < end) { while (p < end) {
@ -1265,7 +1265,7 @@ static int dive_directory(const char *root, const git_tree_entry *entry, const c
return GIT_WALK_SKIP; return GIT_WALK_SKIP;
/* Get the time of day -- parse both time formats so we can read old repos when not on Windows */ /* Get the time of day -- parse both time formats so we can read old repos when not on Windows */
if (sscanf(name+timeoff, "%d:%d:%d", &h, &m, &s) != 3 && sscanf(name+timeoff, "%d=%d=%d", &h, &m, &s) != 3) if (sscanf(name + timeoff, "%d:%d:%d", &h, &m, &s) != 3 && sscanf(name + timeoff, "%d=%d=%d", &h, &m, &s) != 3)
return GIT_WALK_SKIP; return GIT_WALK_SKIP;
if (!validate_time(h, m, s)) if (!validate_time(h, m, s))
return GIT_WALK_SKIP; return GIT_WALK_SKIP;
@ -1491,7 +1491,7 @@ static int parse_dive_entry(struct git_parser_state *state, const git_tree_entry
if (!blob) if (!blob)
return report_error("Unable to read dive file"); return report_error("Unable to read dive file");
if (*suffix) if (*suffix)
dive->number = atoi(suffix+1); dive->number = atoi(suffix + 1);
state->cylinder_index = 0; state->cylinder_index = 0;
clear_weightsystem_table(&state->active_dive->weightsystems); clear_weightsystem_table(&state->active_dive->weightsystems);
state->o2pressure_sensor = 1; state->o2pressure_sensor = 1;
@ -1550,7 +1550,7 @@ static int parse_picture_entry(struct git_parser_state *state, const git_tree_en
if (sscanf(name, "%c%d:%d:%d", &sign, &hh, &mm, &ss) != 4 && if (sscanf(name, "%c%d:%d:%d", &sign, &hh, &mm, &ss) != 4 &&
sscanf(name, "%c%d=%d=%d", &sign, &hh, &mm, &ss) != 4) sscanf(name, "%c%d=%d=%d", &sign, &hh, &mm, &ss) != 4)
return report_error("Unknown file name %s", name); return report_error("Unknown file name %s", name);
offset = ss + 60*(mm + 60*hh); offset = ss + 60 * (mm + 60 * hh);
if (sign == '-') if (sign == '-')
offset = -offset; offset = -offset;
@ -1627,7 +1627,7 @@ void clear_git_id(void)
void set_git_id(const struct git_oid * id) void set_git_id(const struct git_oid * id)
{ {
static char git_id_buffer[GIT_OID_HEXSZ+1]; static char git_id_buffer[GIT_OID_HEXSZ + 1];
git_oid_tostr(git_id_buffer, sizeof(git_id_buffer), id); git_oid_tostr(git_id_buffer, sizeof(git_id_buffer), id);
saved_git_id = git_id_buffer; saved_git_id = git_id_buffer;
@ -1668,7 +1668,7 @@ static int do_git_load(git_repository *repo, const char *branch, struct git_pars
const char *get_sha(git_repository *repo, const char *branch) const char *get_sha(git_repository *repo, const char *branch)
{ {
static char git_id_buffer[GIT_OID_HEXSZ+1]; static char git_id_buffer[GIT_OID_HEXSZ + 1];
git_commit *commit; git_commit *commit;
if (find_commit(repo, branch, &commit)) if (find_commit(repo, branch, &commit))
return NULL; return NULL;