Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
relleums committed Jun 4, 2024
1 parent b66b470 commit 73230df
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 27 deletions.
5 changes: 2 additions & 3 deletions libs/mli/src/mliIo.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ int mli_line_viewer_write(
return 0;
}

int mliIo_write_from_file(struct mliIo *byt, FILE* f, const uint64_t size)
int mliIo_write_from_file(struct mliIo *byt, FILE *f, const uint64_t size)
{
chk_msg(f, "Expected file to be open.");
chk_msg(byt->cstr != NULL, "Expected buffer to be allocated.");
Expand All @@ -427,8 +427,7 @@ int mliIo_write_from_file(struct mliIo *byt, FILE* f, const uint64_t size)
return 0;
}


int mliIo_read_to_file(struct mliIo *byt, FILE* f, const uint64_t size)
int mliIo_read_to_file(struct mliIo *byt, FILE *f, const uint64_t size)
{
chk_msg(f, "Expected file to be open.");
chk_msg(byt->cstr != NULL, "Expected buffer to be allocated.");
Expand Down
4 changes: 2 additions & 2 deletions libs/mli/src/mliIo.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ int mliIo_malloc_capacity(struct mliIo *byt, const uint64_t capacity);
int mliIo_malloc(struct mliIo *byt);
int64_t mliIo_malloc_cstr(struct mliIo *byt, const char *s);
int mliIo_malloc_from_path(struct mliIo *byt, const char *path);
int mliIo_write_from_file(struct mliIo *byt, FILE* f, const uint64_t size);
int mliIo_read_to_file(struct mliIo *byt, FILE* f, const uint64_t size);
int mliIo_write_from_file(struct mliIo *byt, FILE *f, const uint64_t size);
int mliIo_read_to_file(struct mliIo *byt, FILE *f, const uint64_t size);
int mliIo_read_to_path(struct mliIo *byt, const char *path);
int mliIo_putc(struct mliIo *byt, const unsigned char c);
int mliIo_putchar(struct mliIo *byt, const char c);
Expand Down
7 changes: 4 additions & 3 deletions libs/mli/src/mliTarIo.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <stdio.h>
#include "chk.h"


int mliTar_read_data_to_io(
struct mliTar *tar,
struct mliIo *buff,
Expand All @@ -23,7 +22,9 @@ int mliTar_read_data_to_io(
}

int mliTar_write_data_from_io(
struct mliTar *tar, struct mliIo *buff, const uint64_t size)
struct mliTar *tar,
struct mliIo *buff,
const uint64_t size)
{
uint64_t i;
chk_msg(tar->stream, "tar is not open.");
Expand All @@ -32,7 +33,7 @@ int mliTar_write_data_from_io(
unsigned char c;
chk(rc != EOF);
c = (char)(rc);
chk(mliTar_write_data(tar, (void*)(&c), 1));
chk(mliTar_write_data(tar, (void *)(&c), 1));
}

return 1;
Expand Down
10 changes: 8 additions & 2 deletions libs/mli/src/mliTarIo.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#include "mliIo.h"
#include "mliTar.h"

int mliTar_read_data_to_io(struct mliTar *tar, struct mliIo *buff, const uint64_t size);
int mliTar_write_data_from_io(struct mliTar *tar, struct mliIo *buff, const uint64_t size);
int mliTar_read_data_to_io(
struct mliTar *tar,
struct mliIo *buff,
const uint64_t size);
int mliTar_write_data_from_io(
struct mliTar *tar,
struct mliIo *buff,
const uint64_t size);
#endif
31 changes: 15 additions & 16 deletions libs/mli_corsika/src/mli_corsika_Histogram2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
#include "../../mli/src/chk.h"
#include "../../mli/src/mli_math.h"

MLIDYNARRAY_IMPLEMENTATION(mli, CorsikaHistogram2dBin, struct mliCorsikaHistogram2dBin)
MLIDYNARRAY_IMPLEMENTATION(
mli,
CorsikaHistogram2dBin,
struct mliCorsikaHistogram2dBin)

struct key {
int32_t x;
Expand Down Expand Up @@ -80,20 +83,20 @@ int mliCorsikaHistogram2d_flatten__(
bin.y = key.i4i4.y;
bin.value = mli_interpret_int64_as_double(node->value);

chk_msg(
mliDynCorsikaHistogram2dBin_push_back(f, bin),
"Failed to push back bin-node."
);

chk_msg(mliDynCorsikaHistogram2dBin_push_back(f, bin),
"Failed to push back bin-node.");

if (node->avl.left != NULL) {
struct mliAvlNode *left = (struct mliAvlNode *)(node->avl.left);
chk_msg(mliCorsikaHistogram2d_flatten__(left, f), "Failed left");
struct mliAvlNode *left =
(struct mliAvlNode *)(node->avl.left);
chk_msg(mliCorsikaHistogram2d_flatten__(left, f),
"Failed left");
}
if (node->avl.right != NULL) {
struct mliAvlNode *right =
(struct mliAvlNode *)(node->avl.right);
chk_msg(mliCorsikaHistogram2d_flatten__(right, f), "Failed right");
chk_msg(mliCorsikaHistogram2d_flatten__(right, f),
"Failed right");
}
return 1;
}
Expand All @@ -106,13 +109,9 @@ int mliCorsikaHistogram2d_flatten(
const struct mliCorsikaHistogram2d *hist,
struct mliDynCorsikaHistogram2dBin *f)
{
chk_msg(
mliCorsikaHistogram2d_flatten__(
(const struct mliAvlNode *)hist->dict.tree.root,
f
),
"Failed to write dict."
);
chk_msg(mliCorsikaHistogram2d_flatten__(
(const struct mliAvlNode *)hist->dict.tree.root, f),
"Failed to write dict.");

return 1;
chk_error:
Expand Down
5 changes: 4 additions & 1 deletion libs/mli_corsika/src/mli_corsika_Histogram2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ struct mliCorsikaHistogram2dBin {
double value;
};

MLIDYNARRAY_DEFINITON(mli, CorsikaHistogram2dBin, struct mliCorsikaHistogram2dBin)
MLIDYNARRAY_DEFINITON(
mli,
CorsikaHistogram2dBin,
struct mliCorsikaHistogram2dBin)

struct mliCorsikaHistogram2d mliCorsikaHistogram2d_init(void);

Expand Down

0 comments on commit 73230df

Please sign in to comment.