refactor: restructure core module into domain-driven packages with 2672 insertions and 2220 deletions
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:
2025-03-20 03:16:06 +00:00
parent d7066154a9
commit 835662a76a
91 changed files with 27033 additions and 2220 deletions
+67
View File
@@ -0,0 +1,67 @@
#ifndef RHASHTABLE_H
#define RHASHTABLE_H
/*
ORIGINAL SOURCE IS FROM K&R
*/
#include "rmalloc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HASHSIZE 101
// Structure for the table entries
typedef struct rnlist {
struct rnlist *next;
char *name;
char *defn;
} rnlist;
// Hash table array
static rnlist *rhashtab[HASHSIZE];
// Hash function
unsigned rhash(char *s) {
unsigned hashval;
for (hashval = 0; *s != '\0'; s++)
hashval = *s + 31 * hashval;
return hashval % HASHSIZE;
}
rnlist *rlget(char *s) {
rnlist *np;
for (np = rhashtab[rhash(s)]; np != NULL; np = np->next)
if (strcmp(s, np->name) == 0)
return np; // Found
return NULL; // Not found
}
// Lookup function
char *rget(char *s) {
rnlist *np = rlget(s);
return np ? np->defn : NULL;
}
// Install function (adds a name and definition to the table)
struct rnlist *rset(char *name, char *defn) {
struct rnlist *np = NULL;
unsigned hashval;
if ((rlget(name)) == NULL) { // Not found
np = (struct rnlist *)malloc(sizeof(*np));
if (np == NULL || (np->name = strdup(name)) == NULL)
return NULL;
hashval = rhash(name);
np->next = rhashtab[hashval];
rhashtab[hashval] = np;
} else {
if (np->defn)
free((void *)np->defn);
np->defn = NULL;
}
if ((np->defn = strdup(defn)) == NULL)
return NULL;
return np;
}
#endif