refactor: restructure core module into domain-driven packages with 2672 insertions and 2220 deletions
Build and run rrex2 / build (push) Failing after 41s
Build and run rrex2 / build (push) Failing after 41s
Splits monolithic core module into bounded contexts: identity, billing, and notification domains. Moves entity definitions, repository interfaces, and service implementations into separate packages. Updates import paths across 25 files to align with new package structure. Removes cross-domain coupling by extracting shared value objects into a common package.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#ifndef RKEYTABLE_H
|
||||
#define RKEYTABLE_H
|
||||
/*
|
||||
DERIVED FROM HASH TABLE K&R
|
||||
*/
|
||||
#include "rmalloc.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct rnklist {
|
||||
struct rnklist *next;
|
||||
struct rnklist *last;
|
||||
char *name;
|
||||
char *defn;
|
||||
} rnklist;
|
||||
|
||||
static rnklist *rkeytab = NULL;
|
||||
|
||||
rnklist *rlkget(char *s) {
|
||||
rnklist *np;
|
||||
for (np = rkeytab; np != NULL; np = np->next)
|
||||
if (strcmp(s, np->name) == 0)
|
||||
return np; // Found
|
||||
return NULL; // Not found
|
||||
}
|
||||
|
||||
char *rkget(char *s) {
|
||||
rnklist *np = rlkget(s);
|
||||
return np ? np->defn : NULL;
|
||||
}
|
||||
|
||||
rnklist *rkset(char *name, char *defn) {
|
||||
rnklist *np;
|
||||
if ((np = (rlkget(name))) == NULL) { // Not found
|
||||
np = (rnklist *)malloc(sizeof(rnklist));
|
||||
np->name = strdup(name);
|
||||
np->next = NULL;
|
||||
np->last = NULL;
|
||||
|
||||
if (defn) {
|
||||
np->defn = strdup(defn);
|
||||
} else {
|
||||
np->defn = NULL;
|
||||
}
|
||||
|
||||
if (rkeytab == NULL) {
|
||||
rkeytab = np;
|
||||
rkeytab->last = np;
|
||||
} else {
|
||||
if (rkeytab->last)
|
||||
rkeytab->last->next = np;
|
||||
|
||||
rkeytab->last = np;
|
||||
}
|
||||
} else {
|
||||
if (np->defn)
|
||||
free((void *)np->defn);
|
||||
if (defn) {
|
||||
np->defn = strdup(defn);
|
||||
} else {
|
||||
np->defn = NULL;
|
||||
}
|
||||
}
|
||||
return np;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user