Skip to content

Commit

Permalink
move to consistent foo_debug() signature for our dd debugger command
Browse files Browse the repository at this point in the history
  • Loading branch information
jejones3141 committed Jan 30, 2025
1 parent 258aa39 commit 56576cd
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/bin/unit_test_attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ static void command_print(void)
void *walk_ctx = NULL;

printf("Command hierarchy --------");
fr_command_debug(stdout, command_head);
fr_cmd_debug(stdout, command_head);

printf("Command list --------");
while (fr_command_walk(command_head, &walk_ctx, NULL, command_walk) == 1) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/io/atomic_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ bool fr_atomic_queue_push(fr_atomic_queue_t *aq, void *data)
*/
if (diff < 0) {
#if 0
fr_atomic_queue_debug(aq, stderr);
fr_atomic_queue_debug(stderr, aq);
#endif
return false;
}
Expand Down Expand Up @@ -298,7 +298,7 @@ typedef struct {
* @param[in] aq The atomic queue to debug.
* @param[in] fp where the debugging information will be printed.
*/
void fr_atomic_queue_debug(fr_atomic_queue_t *aq, FILE *fp)
void fr_atomic_queue_debug(FILE * fp, fr_atomic_queue_t *aq)
{
size_t i;
int64_t head, tail;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/io/atomic_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void fr_atomic_queue_verify(fr_atomic_queue_t *aq);
#endif

#ifndef NDEBUG
void fr_atomic_queue_debug(fr_atomic_queue_t *aq, FILE *fp);
void fr_atomic_queue_debug(FILE *fp, fr_atomic_queue_t *aq);
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/lib/io/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ void fr_message_set_gc(fr_message_set_t *ms)
* @param[in] ms the message set
* @param[in] fp the FILE where the messages are printed.
*/
void fr_message_set_debug(fr_message_set_t *ms, FILE *fp)
void fr_message_set_debug(FILE *fp, fr_message_set_t *ms)
{
int i;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/io/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fr_message_t *fr_message_localize(TALLOC_CTX *ctx, fr_message_t *m, size_t messa
int fr_message_set_messages_used(fr_message_set_t *ms) CC_HINT(nonnull);
void fr_message_set_gc(fr_message_set_t *ms) CC_HINT(nonnull);

void fr_message_set_debug(fr_message_set_t *ms, FILE *fp) CC_HINT(nonnull);
void fr_message_set_debug(FILE *fp, fr_message_set_t *ms) CC_HINT(nonnull);

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/io/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ int fr_queue_localize_atomic(fr_queue_t *fq, fr_atomic_queue_t *aq)
#ifndef NDEBUG
/** Dump a queue.
*
* @param[in] fq the queue
* @param[in] fp where the debugging information will be printed.
* @param[in] fq the queue
*/
void fr_queue_debug(fr_queue_t *fq, FILE *fp)
void fr_queue_debug(FILE *fp, fr_queue_t *fq)
{
int i;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/io/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int fr_queue_num_elements(fr_queue_t *fq) CC_HINT(nonnull);
int fr_queue_localize_atomic(fr_queue_t *fq, fr_atomic_queue_t *aq) CC_HINT(nonnull);

#ifndef NDEBUG
void fr_queue_debug(fr_queue_t *fq, FILE *fp) CC_HINT(nonnull);
void fr_queue_debug(FILE *fp, fr_queue_t *fq) CC_HINT(nonnull);
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/lib/io/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ int fr_ring_buffer_start(fr_ring_buffer_t *rb, uint8_t **p_start, size_t *p_size
* @param[in] rb the ring buffer
* @param[in] fp the FILE where the messages are printed.
*/
void fr_ring_buffer_debug(fr_ring_buffer_t *rb, FILE *fp)
void fr_ring_buffer_debug(FILE *fp, fr_ring_buffer_t *rb)
{
fprintf(fp, "Buffer %p, write_offset %zu, data_start %zu, data_end %zu\n",
rb->buffer, rb->write_offset, rb->data_start, rb->data_end);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/io/ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ size_t fr_ring_buffer_size(fr_ring_buffer_t *rb) CC_HINT(nonnull);

size_t fr_ring_buffer_used(fr_ring_buffer_t *rb) CC_HINT(nonnull);

void fr_ring_buffer_debug(fr_ring_buffer_t *rb, FILE *fp) CC_HINT(nonnull);
void fr_ring_buffer_debug(FILE *fp, fr_ring_buffer_t *rb) CC_HINT(nonnull);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ static void fr_command_debug_internal(FILE *fp, fr_cmd_t *head, int depth)
}
}

void fr_command_debug(FILE *fp, fr_cmd_t *head)
void fr_cmd_debug(FILE *fp, fr_cmd_t *head)
{
fr_command_debug_internal(fp, head, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int fr_command_walk(fr_cmd_t *head, void **walk_ctx, void *ctx, fr_cmd_walk_t ca
int fr_command_tab_expand(TALLOC_CTX *ctx, fr_cmd_t *head, fr_cmd_info_t *info, int max_expansions, char const **expansions);
char const *fr_command_help(fr_cmd_t *head, int argc, char *argv[]);
int fr_command_run(FILE *fp, FILE *fp_err, fr_cmd_info_t *info, bool read_only);
void fr_command_debug(FILE *fp, fr_cmd_t *head);
void fr_cmd_debug(FILE *fp, fr_cmd_t *head);
int fr_command_str_to_argv(fr_cmd_t *head, fr_cmd_info_t *info, char const *str);
int fr_command_clear(int new_argc, fr_cmd_info_t *info) CC_HINT(nonnull);

Expand Down
10 changes: 5 additions & 5 deletions src/tests/util/atomic_queue_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char *argv[])
#ifndef NDEBUG
if (debug_lvl) {
printf("Start\n");
fr_atomic_queue_debug(aq, stdout);
fr_atomic_queue_debug(stdout, aq);

if (debug_lvl > 1) printf("Filling with %d\n", size);
}
Expand All @@ -111,7 +111,7 @@ int main(int argc, char *argv[])
#ifndef NDEBUG
if (debug_lvl > 1) {
printf("iteration %d\n", i);
fr_atomic_queue_debug(aq, stdout);
fr_atomic_queue_debug(stdout, aq);
}
#endif
}
Expand All @@ -130,7 +130,7 @@ int main(int argc, char *argv[])
#ifndef NDEBUG
if (debug_lvl) {
printf("Full\n");
fr_atomic_queue_debug(aq, stdout);
fr_atomic_queue_debug(stdout, aq);

if (debug_lvl > 1) printf("Emptying\n");
}
Expand All @@ -155,7 +155,7 @@ int main(int argc, char *argv[])
#ifndef NDEBUG
if (debug_lvl > 1) {
printf("iteration %d\n", i);
fr_atomic_queue_debug(aq, stdout);
fr_atomic_queue_debug(stdout, aq);
}
#endif
}
Expand All @@ -171,7 +171,7 @@ int main(int argc, char *argv[])
#ifndef NDEBUG
if (debug_lvl) {
printf("Empty\n");
fr_atomic_queue_debug(aq, stdout);
fr_atomic_queue_debug(stdout, aq);
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/tests/util/channel_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static void *channel_master(void *arg)
MPRINT2("GC\n");
fr_message_set_gc(ms);

if (debug_lvl > 1) fr_message_set_debug(ms, stdout);
if (debug_lvl > 1) fr_message_set_debug(stdout, ms);

/*
* After the garbage collection, all messages marked "done" MUST also be marked "free".
Expand Down Expand Up @@ -466,7 +466,7 @@ static void *channel_worker(void *arg)
MPRINT2("Worker GC\n");
fr_message_set_gc(ms);

if (debug_lvl > 1) fr_message_set_debug(ms, stdout);
if (debug_lvl > 1) fr_message_set_debug(stdout, ms);

/*
* After the garbage collection, all messages marked "done" MUST also be marked "free".
Expand Down
14 changes: 7 additions & 7 deletions src/tests/util/message_set_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ int main(int argc, char *argv[])

MPRINT1("TEST 1 used %d (%zu)\n", fr_message_set_messages_used(ms), used);

if (debug_lvl) fr_message_set_debug(ms, stdout);
if (debug_lvl) fr_message_set_debug(stdout, ms);

/*
* Double the size of the allocations
Expand All @@ -270,7 +270,7 @@ int main(int argc, char *argv[])

MPRINT1("TEST 2 used %d\n", fr_message_set_messages_used(ms));

if (debug_lvl) fr_message_set_debug(ms, stdout);
if (debug_lvl) fr_message_set_debug(stdout, ms);
/*
* Double the size of the allocations
*/
Expand Down Expand Up @@ -299,7 +299,7 @@ int main(int argc, char *argv[])

MPRINT1("TEST 3 used %d\n", fr_message_set_messages_used(ms));

if (debug_lvl) fr_message_set_debug(ms, stdout);
if (debug_lvl) fr_message_set_debug(stdout, ms);

/*
* Do another 1000 rounds of alloc / free.
Expand All @@ -313,7 +313,7 @@ int main(int argc, char *argv[])

MPRINT1("TEST 4 used %d\n", fr_message_set_messages_used(ms));

if (debug_lvl) fr_message_set_debug(ms, stdout);
if (debug_lvl) fr_message_set_debug(stdout, ms);

#if 0

Expand All @@ -335,7 +335,7 @@ int main(int argc, char *argv[])

MPRINT1("TEST 5 used %d\n", fr_message_set_messages_used(ms));

if (debug_lvl) fr_message_set_debug(ms, stdout);
if (debug_lvl) fr_message_set_debug(stdout, ms);

/*
* Double the number of the allocations again,
Expand All @@ -355,7 +355,7 @@ int main(int argc, char *argv[])

MPRINT1("TEST 6 used %d\n", fr_message_set_messages_used(ms));

if (debug_lvl) fr_message_set_debug(ms, stdout);
if (debug_lvl) fr_message_set_debug(stdout, ms);
#endif

my_alloc_size = end - start;
Expand Down Expand Up @@ -396,7 +396,7 @@ int main(int argc, char *argv[])
MPRINT1("GC\n");
fr_message_set_gc(ms);

if (debug_lvl) fr_message_set_debug(ms, stdout);
if (debug_lvl) fr_message_set_debug(stdout, ms);

/*
* After the garbage collection, all messages marked "done" MUST also be marked "free".
Expand Down
2 changes: 1 addition & 1 deletion src/tests/util/radius1_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static void master_process(TALLOC_CTX *ctx)
MPRINT2("GC\n");
fr_message_set_gc(ms);

if (debug_lvl > 1) fr_message_set_debug(ms, stdout);
if (debug_lvl > 1) fr_message_set_debug(stdout, ms);

/*
* After the garbage collection, all messages marked "done" MUST also be marked "free".
Expand Down
2 changes: 1 addition & 1 deletion src/tests/util/worker_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ static void master_process(void)
MPRINT2("GC\n");
fr_message_set_gc(ms);

if (debug_lvl > 1) fr_message_set_debug(ms, stdout);
if (debug_lvl > 1) fr_message_set_debug(stdout, ms);

/*
* After the garbage collection, all messages marked "done" MUST also be marked "free".
Expand Down

0 comments on commit 56576cd

Please sign in to comment.