From 8ee79a1ab2ce374ce0b784866460cfe50c277f11 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 21 May 2020 10:49:15 +1000 Subject: Clear out some no longer needed stuff. --- src/sledjchisl/sledjchisl.c | 93 +-------------------------------------------- 1 file changed, 2 insertions(+), 91 deletions(-) (limited to 'src/sledjchisl/sledjchisl.c') diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 59e00ae..537b435 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -57,7 +57,6 @@ extern char **environ; #include #include -// TODO - audit all the alloc()s and free()s involved in qLibc stuff. #include #include @@ -313,25 +312,6 @@ qhashtbl_t *HTMLfileCache = NULL; typedef struct _reqData reqData; -/* -typedef int (*fieldValidFunc) (reqData *Rd, qhashtbl_t *data, char *name); -typedef struct _validFunc validFunc; -struct _validFunc -{ - char *name, *title; - fieldValidFunc func; -}; - -qlisttbl_t *fieldValidFuncs = NULL; -static void newValidFunc(char *name, char *title, fieldValidFunc func) -{ - validFunc *vf = xmalloc(sizeof(validFunc)); - vf->name = name; vf->title = title; vf->func = func; - fieldValidFuncs->put(fieldValidFuncs, vf->name, vf, sizeof(validFunc)); - free(vf); -} -*/ - typedef void *(*pageFunction) (char *file, reqData *Rd, HTMLfile *thisFile); typedef struct _dynPage dynPage; struct _dynPage @@ -348,23 +328,6 @@ static void newDynPage(char *name, pageFunction func) free(dp); } -/* -typedef void *(*pageBuildFunction) (reqData *Rd, char *message); -typedef struct _buildPage buildPage; -struct _buildPage -{ - char *name; - pageBuildFunction func, eFunc; -}; -qhashtbl_t *buildPages; -static void newBuildPage(char *name, pageBuildFunction func, pageBuildFunction eFunc) -{ - buildPage *bp = xmalloc(sizeof(buildPage)); - bp->name = name; bp->func = func; bp->eFunc = eFunc; - buildPages->put(buildPages, bp->name, bp, sizeof(buildPage)); - free(bp); -} -*/ #define HMACSIZE EVP_MAX_MD_SIZE * 2 #define HMACSIZE64 88 @@ -416,7 +379,6 @@ struct _reqData gridStats *stats; qlist_t *errors, *messages; qgrow_t *reply; -// pageBuildFunction func; struct timespec then; boolean fromDb; }; @@ -1976,7 +1938,7 @@ my_ulonglong dbCount(MYSQL *db, char *table, char *where) perror_msg("Unable to get the time."); double n = (now.tv_sec * 1000000000.0) + now.tv_nsec; double t = (then.tv_sec * 1000000000.0) + then.tv_nsec; - T("dbCount(%s) took %lf seconds", sql, (n - t) / 1000000000.0); +// T("dbCount(%s) took %lf seconds", sql, (n - t) / 1000000000.0); free(sql); return ret; } @@ -2025,7 +1987,7 @@ my_ulonglong dbCountJoin(MYSQL *db, char *table, char *select, char *join, char perror_msg("Unable to get the time."); double n = (now.tv_sec * 1000000000.0) + now.tv_nsec; double t = (then.tv_sec * 1000000000.0) + then.tv_nsec; - T("dbCointJoin(%s) took %lf seconds", sql, (n - t) / 1000000000.0); +// T("dbCointJoin(%s) took %lf seconds", sql, (n - t) / 1000000000.0); free(sql); return ret; } @@ -4491,8 +4453,6 @@ static int nameValidate(reqData *Rd, inputForm *iF, inputValue *iV) unsigned char *name; // We have to be unsigned coz of isalnum(). char *where = NULL; -//d("nameValidate %s", iV->field->name); - name = xstrdup(iV->value); if ((NULL == name) || ('\0' == name[0])) @@ -4926,8 +4886,6 @@ static void accountWebHeaders(reqData *Rd, inputForm *oF) //, char *name) free(nm); } free(linky); -// if (NULL != name) -// Rd->reply->addstrf(Rd->reply, "

account for %s

\n", name); if (0 != Rd->errors->size(Rd->messages)) HTMLlist(Rd->reply, "messages -", Rd->messages); if (NULL != oF->help) @@ -4977,8 +4935,6 @@ static void accountWebFooter(reqData *Rd, inputForm *oF) static void accountAddWeb(reqData *Rd, inputForm *oF, inputValue *oV) { -// char *name = getStrH(Rd->database, "Lua.name"); - accountWebHeaders(Rd, oF); accountWebFields(Rd, oF, oV); accountWebSubs(Rd, oF); @@ -5017,8 +4973,6 @@ static void accountViewWeb(reqData *Rd, inputForm *oF, inputValue *oV) Rd->reply->addstrf(Rd->reply, "

Email : %s

", email); Rd->reply->addstrf(Rd->reply, "

UUID : %s

", getStrH(Rd->database, "UserAccounts.PrincipalID")); Rd->reply->addstrf(Rd->reply, "

Voucher : %s

", voucher); -// Rd->reply->addstrf(Rd->reply, "

About :

" -// "", qurl_decode(getStrH(Rd->database, "Lua.aboutMe"))); HTMLtextArea(Rd->reply, "aboutMe", "About", 7, 50, 4, 16384, "", "off", "true", "soft", about, FALSE, TRUE); accountWebSubs(Rd, oF); accountWebFooter(Rd, oF); @@ -5849,11 +5803,6 @@ static int collectFields(reqData *Rd, inputForm *iF, inputValue *iV, int t) case 1 : vl = Rd->body-> getstr(Rd->body, obj.name, false); break; case 2 : vl = Rd->queries->getstr(Rd->queries, obj.name, false); break; case 3 : vl = Rd->queries->getstr(Rd->stuff, obj.name, false); break; - // Rd->stuff comes from the database reads and calculated stuff, which we do later with this new architecture. The old version validated Rd->stuff as well. - // It was doing that so we can pick up any UUID, validate it, and read in relevant records. - // For newbies their UUID was generated during the validation of name. - // Should still validate that it's long enough and in the correct format, coz that's coming from RD->body sometimes. - // The rest can happen in the submit functions now. default: break; } if ((NULL != iV[i].value) && (NULL != vl)) @@ -5876,40 +5825,6 @@ static int collectFields(reqData *Rd, inputForm *iF, inputValue *iV, int t) return i; } -/* -void listPage(reqData *Rd, char *message) -{ -// TODO - should check if the user is a god before allowing this. - char *name = getStrH(Rd->stuff, "name"), *linky = checkLinky(Rd); - char *toke_n_munchie = getCookie(Rd->Rcookies, "toke_n_munchie"); - - HTMLheader(Rd->reply, " account manager"); - if (DEBUG) HTMLdebug(Rd->reply); - Rd->reply->addstrf(Rd->reply, "

account manager

\n"); - Rd->reply->addstrf(Rd->reply, "

member accounts

\n"); - Rd->reply->addstr(Rd->reply, linky); - free(linky); - if (0 != Rd->errors->size(Rd->messages)) - HTMLlist(Rd->reply, "messages -", Rd->messages); - HTMLtable(Rd->reply, Rd->db, - dbSelect(Rd->db, "UserAccounts", - "CONCAT(FirstName,' ',LastName) as Name,UserTitle as Title,UserLevel as Level,UserFlags as Flags,PrincipalID as UUID", - NULL, NULL, "Name"), - "member accounts", NULL, NULL); - HTMLform(Rd->reply, "", Rd->shs.munchie); - HTMLhidden(Rd->reply, "form", "accountExplore"); - HTMLhidden(Rd->reply, "name", name); - HTMLhidden(Rd->reply, "UUID", Rd->shs.UUID); - Rd->reply->addstrf(Rd->reply, "\n"); // Stop Enter key on text fields triggering the first submit button. - HTMLbutton(Rd->reply, "me", "me"); - HTMLbutton(Rd->reply, "logout", "logout"); - if (0 != Rd->errors->size(Rd->errors)) - HTMLlist(Rd->reply, "errors -", Rd->errors); - Rd->reply->addstrf(Rd->reply, "

%s

\n", message); - HTMLfooter(Rd->reply); -} -*/ - void sessionStateEngine(reqData *Rd, char *type) { @@ -6371,7 +6286,6 @@ static void cleanup(void) { inputForm *f = (inputForm *) obj.data; -//d("%s = %s", obj.name, (char *) obj.data); f->subs->free(f->subs); qlisttbl_obj_t fobj; @@ -6392,8 +6306,6 @@ static void cleanup(void) accountPages = NULL; } -// if (fieldValidFuncs) fieldValidFuncs->free(fieldValidFuncs); -// if (buildPages) buildPages->free(buildPages); if (dynPages) dynPages->free(dynPages); dynPages = NULL; if (HTMLfileCache) @@ -7010,7 +6922,6 @@ t("BODY"); E("Failed to open %s, it's not a virtual file either", toybuf); goto sendReply; } -// I("Dynamic page %s found.", dp->name); dp->func(toybuf, Rd, thisFile); char *finl = Rd->reply->tostring(Rd->reply); // This mallocs new storage and returns it to us. // TODO - maybe cache this? -- cgit v1.1