separator module #1

Merged
poz merged 5 commits from krizej/modfetch:sepmodule into master 2024-02-09 22:48:17 +01:00
Contributor

first module which uses the config :-)

first module which uses the config :-)
krizej added 3 commits 2024-02-09 16:22:14 +01:00
poz requested changes 2024-02-09 21:47:16 +01:00
modules/sep.c Outdated
@ -0,0 +22,4 @@
static size_t sep_char_length = 1;
void init(char **config) {
for(char *opt = *config; opt != NULL; opt = *++config) {
Owner

for(...) -> for (...)
same for if

`for(...)` -> `for (...)` same for if
Author
Contributor

why not functions though boy

why not functions though boy
Owner

functions are simply built different

functions are simply built different
Author
Contributor

that is why their braces should be on a new line ;-)

that is why their braces should be on a new line ;-)
krizej marked this conversation as resolved
modules/sep.c Outdated
@ -0,0 +23,4 @@
void init(char **config) {
for(char *opt = *config; opt != NULL; opt = *++config) {
if(!strncmp(opt, "sep", 3)) {
Owner

instead of ! use == 0, same in the if below

instead of `!` use `== 0`, same in the if below
krizej marked this conversation as resolved
modules/sep.c Outdated
@ -0,0 +35,4 @@
if(*value != 0) { // todo: see if there are any more characters that should be rejected
sep_char_length = strlen(value);
sep_char = malloc(sep_char_length + 1);
Owner

in all the mallocs do sizeof(type) even if the size is 1 byte

in all the mallocs do `sizeof(type)` even if the size is 1 byte
krizej marked this conversation as resolved
poz requested changes 2024-02-09 21:51:51 +01:00
modules/sep.c Outdated
@ -0,0 +18,4 @@
const char *module_name(void) { return "sep"; }
static size_t length = 8;
static char *sep_char = "-";
Owner

implicitly cast the literal to char* because of a warning

modules/sep.c:21:25: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   21 | static char *sep_char = "-";
      |                         ^~~
implicitly cast the literal to `char*` because of a warning ``` modules/sep.c:21:25: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 21 | static char *sep_char = "-"; | ^~~ ```
Author
Contributor

that produces basically the same warning but don't worry i've found a way :-)

that produces basically the same warning but don't worry i've found a way :-)
Owner

turn it back to "-"

turn it back to "-"
krizej marked this conversation as resolved
krizej added 1 commit 2024-02-09 22:17:37 +01:00
krizej started working 2024-02-09 22:17:50 +01:00
krizej stopped working 2024-02-09 22:17:55 +01:00
5 seconds
krizej deleted spent time 2024-02-09 22:18:04 +01:00
- 5 seconds
krizej added spent time 2024-02-09 22:18:26 +01:00
7 hours
krizej added spent time 2024-02-09 22:18:43 +01:00
7 hours
krizej deleted spent time 2024-02-09 22:18:52 +01:00
- 7 hours
Author
Contributor

converts minutes into hours :-(

converts minutes into hours :-(
krizej requested review from poz 2024-02-09 22:19:22 +01:00
krizej added 1 commit 2024-02-09 22:43:57 +01:00
poz merged commit b15ab051f0 into master 2024-02-09 22:48:17 +01:00
poz referenced this pull request from a commit 2024-02-09 22:48:17 +01:00
Sign in to join this conversation.
No reviewers
poz
No labels
No milestone
No project
No assignees
2 participants
Notifications
Total time spent: 7 hours
krizej
7 hours
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: poz/modfetch#1
No description provided.