Skip to content

Commit 5d9e40b

Browse files
committed
Unify function comment style
Use doxygen java-style function comments already used in log.[c|h].
1 parent 2324888 commit 5d9e40b

File tree

4 files changed

+45
-31
lines changed

4 files changed

+45
-31
lines changed

other/bootstrap_daemon/src/command_line_arguments.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
#include <stdlib.h>
3232
#include <string.h>
3333

34-
// Prints --help message
3534

35+
/**
36+
* Prints --help message
37+
*/
3638
void print_help()
3739
{
3840
// 2 space ident

other/bootstrap_daemon/src/command_line_arguments.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@
2727

2828
#include "log.h"
2929

30-
// Handles command line arguments, setting cfg_file_path and log_backend.
31-
// Terminates the application if incorrect arguments are specified.
32-
30+
/**
31+
* Handles command line arguments, setting cfg_file_path and log_backend.
32+
* Terminates the application if incorrect arguments are specified.
33+
*
34+
* @param argc Argc passed into main().
35+
* @param argv Argv passed into main().
36+
* @param cfg_file_path Sets to the provided by the user config file path.
37+
* @param log_backend Sets to the provided by the user log backend option.
38+
* @param run_in_foreground Sets to the provided by the user foreground option.
39+
*/
3340
void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOG_BACKEND *log_backend, bool *run_in_foreground);
3441

3542
#endif // COMMAND_LINE_ARGUMENTS_H

other/bootstrap_daemon/src/config.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@
3535

3636
#include "../../bootstrap_node_packets.h"
3737

38-
// Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array
39-
//
40-
// Supposed to be called from get_general_config only
41-
//
42-
// Important: iff `tcp_relay_port_count` > 0, then you are responsible for freeing `tcp_relay_ports`
43-
38+
/**
39+
* Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array.
40+
*
41+
* Supposed to be called from get_general_config only.
42+
*
43+
* Important: iff `tcp_relay_port_count` > 0, then you are responsible for freeing `tcp_relay_ports`.
44+
*/
4445
void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int *tcp_relay_port_count)
4546
{
4647
const char *NAME_TCP_RELAY_PORTS = "tcp_relay_ports";
@@ -294,13 +295,15 @@ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **k
294295
return 1;
295296
}
296297

297-
// Converts a hex string with even number of characters into binary
298-
//
299-
// You are responsible for freeing the return value!
300-
//
301-
// Returns binary on success,
302-
// NULL on failure
303-
298+
/**
299+
*
300+
* Converts a hex string with even number of characters into binary.
301+
*
302+
* Important: You are responsible for freeing the return value.
303+
*
304+
* @return binary on success,
305+
* NULL on failure.
306+
*/
304307
uint8_t *hex_string_to_bin(char *hex_string)
305308
{
306309
if (strlen(hex_string) % 2 != 0) {

other/bootstrap_daemon/src/config.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,26 @@
2727

2828
#include "../../../toxcore/DHT.h"
2929

30-
// Gets general config options
31-
//
32-
// Important: you are responsible for freeing `pid_file_path` and `keys_file_path`
33-
// also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports`
34-
// and also `motd` iff `enable_motd` is set
35-
//
36-
// returns 1 on success
37-
// 0 on failure, doesn't modify any data pointed by arguments
38-
30+
/**
31+
* Gets general config options from the config file.
32+
*
33+
* Important: You are responsible for freeing `pid_file_path` and `keys_file_path`
34+
* also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports`
35+
* and also `motd` iff `enable_motd` is set.
36+
*
37+
* @return 1 on success,
38+
* 0 on failure, doesn't modify any data pointed by arguments.
39+
*/
3940
int get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port, int *enable_ipv6,
4041
int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay, uint16_t **tcp_relay_ports,
4142
int *tcp_relay_port_count, int *enable_motd, char **motd);
4243

43-
// Bootstraps nodes listed in the config file
44-
//
45-
// returns 1 on success, some or no bootstrap nodes were added
46-
// 0 on failure, a error accured while parsing config file
47-
44+
/**
45+
* Bootstraps off nodes listed in the config file.
46+
*
47+
* @return 1 on success, some or no bootstrap nodes were added
48+
* 0 on failure, a error accured while parsing config file.
49+
*/
4850
int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6);
4951

5052
#endif // CONFIG_H

0 commit comments

Comments
 (0)