commit 8e084b577ff0735a82c44606151da53ac116f49f
parent 11daedd886bccb66d520d6589930d8a9abf28bb5
Author: Remy Noulin <loader2x@gmail.com>
Date: Sat, 7 Aug 2021 14:00:17 +0000
check return values and print error message
src/common.c | 24 ++--
src/parser/parser.c | 122 ++++++++++----------
src/sheepy.c | 320 ++++++++++++++++++++++++++--------------------------
src/spm.c | 156 ++++++++++++-------------
4 files changed, 311 insertions(+), 311 deletions(-)
Diffstat:
| M | src/common.c | | | 24 | ++++++++++++------------ |
| M | src/parser/parser.c | | | 122 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
| M | src/sheepy.c | | | 320 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
| M | src/spm.c | | | 156 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
4 files changed, 311 insertions(+), 311 deletions(-)
diff --git a/src/common.c b/src/common.c
@@ -91,13 +91,13 @@ smallJsont *loadSheepyConfig(char **homedir) {
*homedir = expandHomeG(HOME_DIR);
char *file = catS(*homedir, CONFIG_NAME);
if (!fileExists(*homedir) || !fileExists(file)) {
- mkdirParents(*homedir);
- writeFileG(defaultSpC, file);
+ pError0(mkdirParents(*homedir));
+ pError0(writeFileG(defaultSpC, file));
}
// load sheepy configuration
createAllocateSmallJson(cfgJ);
- readFileG(cfgJ, file);
+ pErrorNULL(readFileG(cfgJ, file));
free(file);
return(cfgJ);
}
@@ -125,8 +125,8 @@ void sourceFromTemplate(const char *filename) {
return;
}
- writeFileG(C_TEMPLATE, fn);
- fileChmod(fn, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ pError0(writeFileG(C_TEMPLATE, fn));
+ pError0(fileChmod(fn, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
free(fn);
}
@@ -151,9 +151,9 @@ void pkgFromTemplate(const char *pkgname) {
toUpper(testname[0]);
char *memcheckname = dupG(testname);;
char *asanname = dupG(testname);;
- iPrependS(&testname, "test");
- iPrependS(&memcheckname, "memcheck");
- iPrependS(&asanname, "asan");
+ pErrorNULL(iPrependS(&testname, "test"));
+ pErrorNULL(iPrependS(&memcheckname, "memcheck"));
+ pErrorNULL(iPrependS(&asanname, "asan"));
char *t = replaceManyS(PKG_TEMPLATE, "<PKG_NAME>", pkgname, "<TEST_NAME>", testname, "<MEMCHECK_NAME>", memcheckname, "<ASAN_NAME>", asanname);;
@@ -236,22 +236,22 @@ char* findLocalPackageDir(smallDictt* cfgD) {
char **spl = splitG(cwd, '/');
while (!isBlankG(spl)) {
char *p = joinG(spl, '/');;
- iAppendManyS(&p, "/", PACKAGE_DIR);
+ pErrorNULL(iAppendManyS(&p, "/", PACKAGE_DIR));
if (isDir(p)) {
localPackageDir = p;
break;
}
//logVarG(p);
free(p);
- delG(&spl, -1, 0);
+ pErrorNULL(delG(&spl, -1, 0));
}
freeG(spl);
free(cwd);
// ignore found dir if it is the global package dir
char *packageDir = catS(getG(cfgD, rtChar, "system") , "/", PACKAGE_DIR);
- normalizePathG(&packageDir);
- expandHomeG(&packageDir);
+ pErrorNULL(normalizePathG(&packageDir));
+ pErrorNULL(expandHomeG(&packageDir));
if (eqG(localPackageDir, packageDir)) {
// revert to default package dir, the local package dir cant be the global package dir
free(localPackageDir);
diff --git a/src/parser/parser.c b/src/parser/parser.c
@@ -187,17 +187,17 @@ int STATES[FINAL][TRANSITIONS*2] = {
void toCString(char *text) {
// convert to C string
char *tmp = dupS(text);
- setS(tmp, 0, '\"');
- setS(tmp, -1, '\"');
+ pErrorNULL(setS(tmp, 0, '\"'));
+ pErrorNULL(setS(tmp, -1, '\"'));
// TODO regular expression
- iReplaceS_max(&tmp, "\'", "'");
- pushNFreeG(sheepyC, tmp);
+ pErrorNULL(iReplaceS_max(&tmp, "\'", "'"));
+ pErrorNULL(pushNFreeG(sheepyC, tmp));
return;
}
void generateCodeL() {
smallStringt *tmp = joinG(sheepyC, "");
- pushNFreeG(generatedC, tmp);
+ pErrorNULL(pushNFreeG(generatedC, tmp));
freeG(sheepyC);
//initiateAllocateSmallString(&sheepyC);
}
@@ -207,18 +207,18 @@ void defaultInState(int ste, char *text) {
}
void defaultInStateCopy(int ste, char *text) {
- pushG(sheepyC, " ");
- pushG(sheepyC, text);
+ pErrorNULL(pushG(sheepyC, " "));
+ pErrorNULL(pushG(sheepyC, text));
}
void idle(int ste, char *text) {
}
void type(int ste, char *text) {
- pushG(sheepyC, " ");
- pushG(sheepyC, text);
+ pErrorNULL(pushG(sheepyC, " "));
+ pErrorNULL(pushG(sheepyC, text));
// set next state
- pushG(stateStack, stateM);
+ pErrorNULL(pushG(stateStack, stateM));
stateM = ste;
}
@@ -244,7 +244,7 @@ void typeinitstr(int ste, char *text) {
}
void typeend(int ste, char *text) {
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
stateM = popG(stateStack, rtInt32_t);
@@ -295,14 +295,14 @@ void enum_(int ste, char *text) {
}
void enum_end(int ste, char *text) {
- pushG(sheepyC, "};");
+ pErrorNULL(pushG(sheepyC, "};"));
generateCodeL();
// set next state
stateM = IDLE;
}
void typedef_(int ste, char *text) {
- pushG(sheepyC, "typedef");
+ pErrorNULL(pushG(sheepyC, "typedef"));
// set next state
stateM = ste;
}
@@ -313,9 +313,9 @@ void tdstruct(int ste, char *text) {
}
void structblock(int ste, char *text) {
- pushG(sheepyC, " {");
+ pErrorNULL(pushG(sheepyC, " {"));
generateCodeL();
- pushG(stateStack, stateM);
+ pErrorNULL(pushG(stateStack, stateM));
// set next state
stateM = ste;
}
@@ -341,23 +341,23 @@ void structtypeid(int ste, char *text) {
}
void structtypeend(int ste, char *text) {
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
stateM = STRUCTBLOCK;
}
void structid(int ste, char *text) {
- pushG(textStack, text);
+ pErrorNULL(pushG(textStack, text));
// set next state
stateM = ste;
}
void structblockend(int ste, char *text) {
char *id = popG(textStack, rtChar);
- pushG(sheepyC, "} ");
- pushNFreeG(sheepyC, id);
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, "} "));
+ pErrorNULL(pushNFreeG(sheepyC, id));
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
stateM = popG(stateStack, rtInt32_t);
@@ -400,7 +400,7 @@ void uniontypeid(int ste, char *text) {
}
void uniontypeend(int ste, char *text) {
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
stateM = UNIONBLOCK;
@@ -413,9 +413,9 @@ void unionid(int ste, char *text) {
void unionblockend(int ste, char *text) {
char *id = popG(textStack, rtChar);
- pushG(sheepyC, "} ");
- pushNFreeG(sheepyC, id);
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, "} "));
+ pErrorNULL(pushNFreeG(sheepyC, id));
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
stateM = popG(stateStack, rtInt32_t);
@@ -453,27 +453,27 @@ void prototype(int ste, char *text) {
void codeblock(int ste, char *text) {
if ((stateM == DO_)||(stateM == ELSE_)) {
- pushG(sheepyC, " {");
+ pErrorNULL(pushG(sheepyC, " {"));
}
else {
// close condition statement
- pushG(sheepyC, ") {");
+ pErrorNULL(pushG(sheepyC, ") {"));
}
generateCodeL();
- pushG(stateStack, stateM);
+ pErrorNULL(pushG(stateStack, stateM));
// set next state
stateM = ste;
}
void codeblockid(int ste, char *text) {
- pushG(sheepyC, text);
+ pErrorNULL(pushG(sheepyC, text));
// set next state
pushG(stateStack, stateM);
stateM = ste;
}
void call(int ste, char *text) {
- pushG(sheepyC, "(");
+ pErrorNULL(pushG(sheepyC, "("));
// set next state
stateM = ste;
}
@@ -485,13 +485,13 @@ void callstr(int ste, char *text) {
}
void callclose(int ste, char *text) {
- pushG(sheepyC, ")");
+ pErrorNULL(pushG(sheepyC, ")"));
// set next state
stateM = ste;
}
void callend(int ste, char *text) {
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
// pop to return to CODEBLOCK or CASE_BLOCK
@@ -499,7 +499,7 @@ void callend(int ste, char *text) {
}
void callendnpop(int ste, char *text) {
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
// pop to return to CODEBLOCK or CASE_BLOCK
@@ -523,21 +523,21 @@ void goto_id(int ste, char *text) {
}
void goto_end(int ste, char *text) {
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
stateM = CODEBLOCK;
}
void goto_endnpop(int ste, char *text) {
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, ";"));
generateCodeL();
// set next state
codeblockend(ste, text);
}
void colon(int ste, char *text) {
- pushG(sheepyC, ":");
+ pErrorNULL(pushG(sheepyC, ":"));
generateCodeL();
// set next state
// pop stateM pushed in codeblockid
@@ -569,11 +569,11 @@ void assignment(int ste, char *text) {
void quoted_char(int ste, char *text) {
// convert to C char
text = dupS(text);
- iReplaceS(&text, "'", "\\'", 1);
- setS(text, 0, '\'');
- iAppendS(&text, "'");
- iReplaceS(&text, "\\@", "@", 1);
- pushNFreeG(sheepyC, text);
+ pErrorNULL(iReplaceS(&text, "'", "\\'", 1));
+ pErrorNULL(setS(text, 0, '\''));
+ pErrorNULL(iAppendS(&text, "'"));
+ pErrorNULL(iReplaceS(&text, "\\@", "@", 1));
+ pErrorNULL(pushNFreeG(sheepyC, text));
// set next state
stateM = ste;
}
@@ -583,8 +583,8 @@ void quoted_char_semicolon(int ste, char *text) {
// add space in char
// tabs should be \t
smallStringt *txt = getG(sheepyC, rtSmallStringt, -1);
- setG(txt, 1, ' ');
- pushG(txt, "'");
+ pErrorNULL(setG(txt, 1, ' '));
+ pErrorNULL(pushG(txt, "'"));
// pointer in sheepyC should be updated with setPG sheepyC
// but this string is always short
// the pointer doesn't change
@@ -604,8 +604,8 @@ void assignmentend(int ste, char *text) {
}
void if_(int ste, char *text) {
- pushG(sheepyC, text);
- pushG(sheepyC, " (");
+ pErrorNULL(pushG(sheepyC, text));
+ pErrorNULL(pushG(sheepyC, " ("));
// set next state
stateM = ste;
}
@@ -631,7 +631,7 @@ void switch_(int ste, char *text) {
}
void switch_block(int ste, char *text) {
- pushG(sheepyC, ") {");
+ pErrorNULL(pushG(sheepyC, ") {"));
generateCodeL();
// TODO push stateM >> use structblock function
// set next state
@@ -650,22 +650,22 @@ void case_id(int ste, char *text) {
void case_block(int ste, char *text) {
// add curly brackets around code for case labels
- pushG(sheepyC, ": {");
+ pErrorNULL(pushG(sheepyC, ": {"));
generateCodeL();
- pushG(stateStack, stateM);
+ pErrorNULL(pushG(stateStack, stateM));
// set next state
stateM = ste;
}
void break_(int ste, char *text) {
- pushG(sheepyC, text);
- pushG(sheepyC, ";");
+ pErrorNULL(pushG(sheepyC, text));
+ pErrorNULL(pushG(sheepyC, ";"));
// set next state
stateM = ste;
}
void switch_blockend(int ste, char *text) {
- pushG(sheepyC, "}");
+ pErrorNULL(pushG(sheepyC, "}"));
// TODO pop stateM
// set next state
stateM = CODEBLOCK;
@@ -688,10 +688,10 @@ void return_end(int ste, char *text) {
// replace bracket with semicolon
char *tmp = getG(sheepyC, rtChar, -1);
if (getS(tmp, -1) == '(') {
- setS(tmp, -1, ';');
+ pErrorNULL(setS(tmp, -1, ';'));
}
else {
- pushG(sheepyC, ");");
+ pErrorNULL(pushG(sheepyC, ");"));
}
generateCodeL();
// set next state
@@ -700,7 +700,7 @@ void return_end(int ste, char *text) {
}
void codeblockend(int ste, char *text) {
- pushG(sheepyC, "}");
+ pErrorNULL(pushG(sheepyC, "}"));
// set next state
stateM = popG(stateStack, rtInt32_t);
switch(stateM) {
@@ -738,46 +738,46 @@ void do_end(int ste, char *text) {
}
void do_for(int ste, char *text) {
- pushG(sheepyC, " while (");
+ pErrorNULL(pushG(sheepyC, " while ("));
// set next state
stateM = ste;
}
void do_close(int ste, char *text) {
- pushG(sheepyC, ");");
+ pErrorNULL(pushG(sheepyC, ");"));
generateCodeL();
// set next state
stateM = CODEBLOCK;
}
void use(int ste, char *text) {
- pushG(sheepyC, "#include \"");
+ pErrorNULL(pushG(sheepyC, "#include \""));
// set next state
stateM = ste;
}
void addT(int ste, char *text) {
- pushG(sheepyC, text);
+ pErrorNULL(pushG(sheepyC, text));
// set next state
stateM = ste;
}
void usecomma(int ste, char *text) {
- pushG(sheepyC, "\"");
+ pErrorNULL(pushG(sheepyC, "\""));
generateCodeL();
// expecting more use
use(ste, text);
}
void useend(int ste, char *text) {
- pushG(sheepyC, "\"");
+ pErrorNULL(pushG(sheepyC, "\""));
generateCodeL();
stateM = IDLE;
}
void addSpaceNT(int ste, char *text) {
- pushG(sheepyC, " ");
- pushG(sheepyC, text);
+ pErrorNULL(pushG(sheepyC, " "));
+ pErrorNULL(pushG(sheepyC, text));
// set next state
stateM = ste;
}
diff --git a/src/sheepy.c b/src/sheepy.c
@@ -270,13 +270,13 @@ int MAIN(int ARGC, char** ARGV) {
printf(" The local package repository is located in " UDL "%s" RST "\n", findLocalPackageDir(cfgD));
if (dum) {
char *p = formatS("%s/%s", getG(cfgD, rtChar, "system"), PACKAGE_DIR);
- iNormalizePath(&p);
- iExpandHome(&p);
+ pErrorNULL(iNormalizePath(&p));
+ pErrorNULL(iExpandHome(&p));
printf(" The global package repository is located in " UDL "%s" RST "\n", p);
free(p);
p = formatS("%s/%s", getG(cfgD, rtChar, "system"), "bin");
- iNormalizePath(&p);
- iExpandHome(&p);
+ pErrorNULL(iNormalizePath(&p));
+ pErrorNULL(iExpandHome(&p));
printf(" Commands from packages are added in " UDL "%s" RST "\n", p);
free(p);
}
@@ -466,8 +466,8 @@ int MAIN(int ARGC, char** ARGV) {
terminateG(bin);
char *build = catS(homedir, "build");
if (fileExists(build)) {
- rmAll(build);
- mkdirParents(build);
+ pError0(rmAll(build));
+ pError0(mkdirParents(build));
}
free(build);
XSUCCESS
@@ -494,7 +494,7 @@ int MAIN(int ARGC, char** ARGV) {
XFAILURE
}
char *s = replaceG(C_TEST_TEMPLATE, "testTemplate", getG(&pkgInfo, rtChar, "name"), 0);
- writeFileG(s, testBin);
+ pError0(writeFileG(s, testBin));
free(s);
printf("Generated: "BLD GRN "%s" RST " " UDL "< add the test cases in this file" RST "\n", testBin);
printf("To run the test, execute: " BLD WHT "spm test" RST "\n");
@@ -509,26 +509,26 @@ int MAIN(int ARGC, char** ARGV) {
}
if (!fileExists(MEMTEST_C_TEMPLATE_NAME)) {
- writeFileG(MEMTEST_C_TEMPLATE, MEMTEST_C_TEMPLATE_NAME);
+ pError0(writeFileG(MEMTEST_C_TEMPLATE, MEMTEST_C_TEMPLATE_NAME));
putsG("Generated: "BLD GRN MEMTEST_C_TEMPLATE_NAME RST);
}
if (!fileExists(RUNMEMTEST_TEMPLATE_NAME)) {
- writeFileG(RUNMEMTEST_TEMPLATE, RUNMEMTEST_TEMPLATE_NAME);
- fileChmod(RUNMEMTEST_TEMPLATE_NAME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ pError0(writeFileG(RUNMEMTEST_TEMPLATE, RUNMEMTEST_TEMPLATE_NAME));
+ pError0(fileChmod(RUNMEMTEST_TEMPLATE_NAME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
putsG("Generated: "BLD GRN RUNMEMTEST_TEMPLATE_NAME RST);
}
if (memcheckBin) {
char *shell = NULL;
if (isC(testBin)) {
- setG(testBin, -2, 0);
+ pErrorNULL(setG(testBin, -2, 0));
shell = catS(testBin, "Mem.sh");
// restore original testBin
testBin[strlen(testBin)] = '.';
if (!fileExists(shell)) {
s = replaceManyS(MEMCHECK_SH_TEMPLATE, "testBin", testBin, "memcheckBin", memcheckBin);
- writeFileG(s, shell);
+ pError0(writeFileG(s, shell));
free(s);
- fileChmod(shell, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ pError0(fileChmod(shell, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
printf("Generated: "BLD GRN "%s" RST"\n", shell);
}
}
@@ -538,15 +538,15 @@ int MAIN(int ARGC, char** ARGV) {
if (asanBin) {
char *shell = NULL;
if (isC(testBin)) {
- setG(testBin, -2, 0);
+ pErrorNULL(setG(testBin, -2, 0));
shell = catS(testBin, "Asan.sh");
// restore original testBin
testBin[strlen(testBin)] = '.';
if (!fileExists(shell)) {
s = replaceManyS(ASAN_SH_TEMPLATE, "testBin", testBin, "asanBin", asanBin);
- writeFileG(s, shell);
+ pError0(writeFileG(s, shell));
free(s);
- fileChmod(shell, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ pError0(fileChmod(shell, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
printf("Generated: "BLD GRN "%s" RST"\n", shell);
}
}
@@ -589,17 +589,17 @@ int MAIN(int ARGC, char** ARGV) {
char *s1 = replaceS(C_CLASS_TEMPLATE, "classTemplate", dum, 0);
char *s2 = replaceS(INTERNAL_H_CLASS_TEMPLATE, "classTemplate", dum, 0);
dum[0] = toupper(dum[0]);
- iReplaceS(&s, "ClassTemplate", dum, 0);
- iReplaceS(&s1, "ClassTemplate", dum, 0);
- iReplaceS(&s2, "ClassTemplate", dum, 0);
+ pErrorNULL(iReplaceS(&s, "ClassTemplate", dum, 0));
+ pErrorNULL(iReplaceS(&s1, "ClassTemplate", dum, 0));
+ pErrorNULL(iReplaceS(&s2, "ClassTemplate", dum, 0));
char *DUM = upperS(dum);
- iReplaceS(&s, "CLASSTEMPLATE", DUM, 0);
+ pErrorNULL(iReplaceS(&s, "CLASSTEMPLATE", DUM, 0));
free(DUM);
- writeFileG(s, fn);
- writeFileG(s1, fn1);
- writeFileG(s2, fn2);
+ pError0(writeFileG(s, fn));
+ pError0(writeFileG(s1, fn1));
+ pError0(writeFileG(s2, fn2));
dum[0] = tolower(dum[0]);
printf("Created files for class "BLD GRN"%s"RST":\n%s\n%s\n%s", dum, fn, fn1, fn2); {
@@ -626,7 +626,7 @@ int MAIN(int ARGC, char** ARGV) {
if (fileExists(dum)) {
// add c extension to mainFilename
free(dum);
- pushG(&mainFilename, ".c");
+ pErrorNULL(pushG(&mainFilename, ".c"));
}
else {
free(dum);
@@ -634,7 +634,7 @@ int MAIN(int ARGC, char** ARGV) {
if (fileExists(dum)) {
// add cp extension to mainFilename
free(dum);
- pushG(&mainFilename, ".cp");
+ pErrorNULL(pushG(&mainFilename, ".cp"));
}
else {
free(dum);
@@ -682,7 +682,7 @@ int MAIN(int ARGC, char** ARGV) {
if (fileExists(dum)) {
// add c extension to mainSrc
free(dum);
- pushG(&mainSrc, ".c");
+ pErrorNULL(pushG(&mainSrc, ".c"));
}
else {
free(dum);
@@ -690,7 +690,7 @@ int MAIN(int ARGC, char** ARGV) {
if (fileExists(dum)) {
// add cp extension to mainSrc
free(dum);
- pushG(&mainSrc, ".cp");
+ pErrorNULL(pushG(&mainSrc, ".cp"));
}
else {
free(dum);
@@ -703,14 +703,14 @@ int MAIN(int ARGC, char** ARGV) {
char *exePath = strdup(mainFilename);
if (isC(mainSrc)) {
- setS(exePath, -2, 0);
+ pErrorNULL(setS(exePath, -2, 0));
}
else {
- setS(exePath, -3, 0);
+ pErrorNULL(setS(exePath, -3, 0));
}
char *mainH = strdup(mainSrc);
- setS(mainH, -1, 'h');
+ pErrorNULL(setS(mainH, -1, 'h'));
// [0] root name [1] extension
char **rootMain_l = split(mainSrc, ".");
@@ -723,11 +723,11 @@ int MAIN(int ARGC, char** ARGV) {
// if there is package.yml in dir, check if there are package dependencies and the shpPackages folder
// install the packages when shpPackages is not found
dum = catS(dir, "/"PACKAGE_DIR);
- normalizePathG(&dum);
+ pErrorNULL(normalizePathG(&dum));
if (!sheepyParams.clean && not isDir(dum)) {
free(dum);
dum = catS(dir, "/", PACKAGE);
- normalizePathG(&dum);
+ pErrorNULL(normalizePathG(&dum));
if (fileExists(dum)) {
createSmallJson(pkgInfo);
readFileG(&pkgInfo, dum);
@@ -779,7 +779,7 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm -rf %s", dum);
printf("\n");
}
- rmAll(dum);
+ pError0(rmAll(dum));
}
free(dum);
dum = catS(homedir, "build", actualDir, "Memcheck");
@@ -788,7 +788,7 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm -rf %s", dum);
printf("\n");
}
- rmAll(dum);
+ pError0(rmAll(dum));
}
free(dum);
dum = catS(homedir, "build", actualDir, "Asan");
@@ -797,7 +797,7 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm -rf %s", dum);
printf("\n");
}
- rmAll(dum);
+ pError0(rmAll(dum));
}
free(dum);
}
@@ -822,7 +822,7 @@ int MAIN(int ARGC, char** ARGV) {
createAllocateSmallArray(paramL);
// debug program with parameters on command line
rangeFrom(i, 3, argc)
- pushG(paramL, argv[i]);
+ pErrorNULL(pushG(paramL, argv[i]));
// create parameter string for running the program in argv[1]
// add quotes to keep the same number of arguments
char *params = joinSG(paramL, "\" \"");
@@ -830,8 +830,8 @@ int MAIN(int ARGC, char** ARGV) {
emptyS(params);
}
else {
- prependG(¶ms, "\"");
- pushG(¶ms, "\"");
+ pErrorNULL(prependG(¶ms, "\""));
+ pErrorNULL(pushG(¶ms, "\""));
}
char *debugCommand = formatS("%s %s %s", debuggerCmd, buildExePath, params);;
@@ -849,7 +849,7 @@ int MAIN(int ARGC, char** ARGV) {
XSUCCESS
}
if (!fileExists(buildPath)) {
- mkdirParents(buildPath);
+ pError0(mkdirParents(buildPath));
}
// load main source (mainCode)
@@ -865,7 +865,7 @@ int MAIN(int ARGC, char** ARGV) {
char *hBang = NULL;
hBang = getG(mainFile, hBang, 0);
if (hBang && hBang[0] == '#' && hBang[1] == '!' && findS(hBang, "sheepy")) {
- setG(mainFile, 0, "");
+ pErrorNULL(setG(mainFile, 0, ""));
}
// if main is cp, convert to c in buildpath
@@ -891,8 +891,8 @@ int MAIN(int ARGC, char** ARGV) {
char *mainCPath = catS(buildPath, "/", mainSrc);
if (isCP(mainSrc)) {
// cp file
- setS(mainCPath, -2, 'c');
- setS(mainCPath, -1, 0);
+ pErrorNULL(setS(mainCPath, -2, 'c'));
+ pErrorNULL(setS(mainCPath, -1, 0));
}
writeTextO(cCode, mainCPath);
terminateG(cCode);
@@ -926,14 +926,14 @@ int MAIN(int ARGC, char** ARGV) {
// add new include to inc array
char *realFPath = catS(actualDir, "/", s);
char *buildFPath = catS(buildPath, "/", s);
- iNormalizePath(&realFPath);
- iNormalizePath(&buildFPath);
+ pErrorNULL(iNormalizePath(&realFPath));
+ pErrorNULL(iNormalizePath(&buildFPath));
// create a link to header in buildPath
// because main.c is in buildPath and the compiler needs
// to find the headers
if (symlinkFile(realFPath, buildFPath)) {
- pushG(inc, s);
- pushG(mainDepFiles, s);
+ pErrorNULL(pushG(inc, s));
+ pErrorNULL(pushG(mainDepFiles, s));
}
freeManyS(realFPath, buildFPath);
free(fN);
@@ -945,12 +945,12 @@ int MAIN(int ARGC, char** ARGV) {
// add mainFilename.h to dependencies for cases when mainFilename doesn't include the header
// (this handles empty main source files)
if (isC(mainFilename)) {
- setG(mainFilename, -1, 'h');
+ pErrorNULL(setG(mainFilename, -1, 'h'));
if (fileExistsG(mainFilename) && !hasG(inc, mainH)) {
- pushG(inc, mainH);
- pushG(mainDepFiles, mainH);
+ pErrorNULL(pushG(inc, mainH));
+ pErrorNULL(pushG(mainDepFiles, mainH));
}
- setG(mainFilename, -1, 'c');
+ pErrorNULL(setG(mainFilename, -1, 'c'));
}
setNFreeG(dependencies, mainSrc, mainDepFiles);
@@ -993,11 +993,11 @@ int MAIN(int ARGC, char** ARGV) {
if (!eqG(fN, fileName) && !hasG(inc, s)) {
// add new include to inc array
char *tmp = catS(fileDir, "/", s);
- iNormalizePath(&tmp);
+ pErrorNULL(iNormalizePath(&tmp));
char *realFPath = catS(actualDir, "/", tmp);
char *buildFPath = catS(buildPath, "/", tmp);
- iNormalizePath(&realFPath);
- iNormalizePath(&buildFPath);
+ pErrorNULL(iNormalizePath(&realFPath));
+ pErrorNULL(iNormalizePath(&buildFPath));
//logVarG(fileDir);
//logVarG(s);
//logVarG(realFPath);
@@ -1021,7 +1021,7 @@ int MAIN(int ARGC, char** ARGV) {
// shpPackages/ini/ini.a
smallArrayt *spl = splitG(L, PACKAGE_DIR"/");
smallStringt *last = getG(spl, rtSmallStringt, -1);
- setG(last, -1, 'a');
+ pErrorNULL(setG(last, -1, 'a'));
// last is "ini/src/ini.a"
smallArrayt *sslash = splitG(last, '/');
finishG(last);
@@ -1036,7 +1036,7 @@ int MAIN(int ARGC, char** ARGV) {
else {
free(lib);
}
- setG(L, -1, 'h');
+ pErrorNULL(setG(L, -1, 'h'));
setNFreeG(dependencies, ssGet(L), libDep);
}
terminateG(L);
@@ -1065,11 +1065,11 @@ int MAIN(int ARGC, char** ARGV) {
if (!eqG(fN, fileName)) {
// add new include to inc array
char *tmp = catS(fileDir, "/", s);
- iNormalizePath(&tmp);
+ pErrorNULL(iNormalizePath(&tmp));
char *realFPath = catS(actualDir, "/", tmp);
char *buildFPath = catS(buildPath, "/", tmp);
- iNormalizePath(&realFPath);
- iNormalizePath(&buildFPath);
+ pErrorNULL(iNormalizePath(&realFPath));
+ pErrorNULL(iNormalizePath(&buildFPath));
//logVarG(fileDir);
//logVarG(s);
//logVarG(realFPath);
@@ -1079,9 +1079,9 @@ int MAIN(int ARGC, char** ARGV) {
if (symlinkFile(realFPath, buildFPath)) {
// !hasG(inc, s): add to inc only new files to avoid infinite loops
if (!hasG(inc, s)) {
- pushG(inc, tmp);
+ pErrorNULL(pushG(inc, tmp));
}
- pushG(depFiles, tmp);
+ pErrorNULL(pushG(depFiles, tmp));
}
freeManyS(tmp, realFPath, buildFPath);
}
@@ -1091,18 +1091,18 @@ int MAIN(int ARGC, char** ARGV) {
finishG(hL);
}
- normalizePathO(L);
+ pErrorNULL(normalizePathO(L));
setNFreeG(dependencies, ssGet(L), depFiles);
}
// scan c or cp
freeG(file);
if (isH(fileName)) {
- setG(L, -1, 'c');
+ pErrorNULL(setG(L, -1, 'c'));
}
else {
// scan .cp
- setG(L, -1, 'p');
+ pErrorNULL(setG(L, -1, 'p'));
}
// check if the c is already in dependencies, process only new found sources
@@ -1119,19 +1119,19 @@ int MAIN(int ARGC, char** ARGV) {
// !hasG(inc, s): add to inc only new files to avoid infinite loops
if (s) {
char *tmp = catS(fileDir, "/", s);
- iNormalizePath(&tmp);
+ pErrorNULL(iNormalizePath(&tmp));
char *realFPath = catS(actualDir, "/", tmp);
char *buildFPath = catS(buildPath, "/", tmp);
- iNormalizePath(&realFPath);
- iNormalizePath(&buildFPath);
+ pErrorNULL(iNormalizePath(&realFPath));
+ pErrorNULL(iNormalizePath(&buildFPath));
if (symlinkFile(realFPath, buildFPath)) {
- pushG(depFiles, tmp);
+ pErrorNULL(pushG(depFiles, tmp));
// check if c includes itself
char *fN;
fN = strdup(basename(s));
if (!eqG(fN, fileName) && !hasG(inc, s)) {
// add new include to inc array
- pushG(inc, tmp);
+ pErrorNULL(pushG(inc, tmp));
}
free(fN);
}
@@ -1157,7 +1157,7 @@ int MAIN(int ARGC, char** ARGV) {
// to avoid compiling and linking several times the same file
enumerateSmallArray(inc, hE, i) {
castS(h, hE)
- normalizePathO(h);
+ pErrorNULL(normalizePathO(h));
setNFreePG(inc, i, h);
}
uniqG(inc, unusedV);
@@ -1171,7 +1171,7 @@ int MAIN(int ARGC, char** ARGV) {
// when argv[1] is an option (-l, -c ...) the program is not
// executed
rangeFrom(i, 2, argc)
- pushG(paramL, argv[i]);
+ pErrorNULL(pushG(paramL, argv[i]));
// create parameter string for running the program in argv[1]
// add quotes to keep the same number of arguments
@@ -1180,8 +1180,8 @@ int MAIN(int ARGC, char** ARGV) {
emptyS(params);
}
else {
- prependG(¶ms, "\"");
- pushG(¶ms, "\"");
+ pErrorNULL(prependG(¶ms, "\""));
+ pErrorNULL(pushG(¶ms, "\""));
}
// detect execute bit
@@ -1191,7 +1191,7 @@ int MAIN(int ARGC, char** ARGV) {
if (!sheepyParams.compileLib && !sheepyParams.compileOnly && access(mainFilename, X_OK) == 0) {
// run
// -l is not in the parameters
- iAppendManyS(&run, "; ", buildExePath, " ", params);
+ pErrorNULL(iAppendManyS(&run, "; ", buildExePath, " ", params));
}
else if (!sheepyParams.clean) {
printf(BLD BLU "Compile only" RST " %s\n", rootMain);
@@ -1226,25 +1226,25 @@ int MAIN(int ARGC, char** ARGV) {
// add dependencies from header file to c dependency list
// to recompile when a header is updated
if (isC(k)) {
- setS(k, -1, 'h');
+ pErrorNULL(setS(k, -1, 'h'));
if (hasG(dependencies, k)) {
- appendNFreeG(depsOrig, getNDupG(dependencies, rtSmallArrayt, k));
+ pErrorNULL(appendNFreeG(depsOrig, getNDupG(dependencies, rtSmallArrayt, k)));
}
- setS(k, -1, 'c');
+ pErrorNULL(setS(k, -1, 'c'));
}
elif (isCP(k)) {
- setS(k, -1, 'h');
+ pErrorNULL(setS(k, -1, 'h'));
if (hasG(dependencies, k)) {
- appendNFreeG(depsOrig, getNDupG(dependencies, rtSmallArrayt, k));
+ pErrorNULL(appendNFreeG(depsOrig, getNDupG(dependencies, rtSmallArrayt, k)));
}
- setS(k, -1, 'p');
+ pErrorNULL(setS(k, -1, 'p'));
}
// update depArray pointer in dependencies because it might have been updated
setPG(dependencies, k, depsOrig);
smallArrayt *deps = dupG(depsOrig);
// recursively add dependencies for the C file 'k'
createAllocateSmallArray(depStack);
- pushG(depStack, depsOrig);
+ pErrorNULL(pushG(depStack, depsOrig));
while (not isEmptyG(depStack)) {
smallArrayt *fileDeps = dequeueG(depStack, rtSmallArrayt);;
// for each dep, append dep array to c dep array
@@ -1254,9 +1254,9 @@ int MAIN(int ARGC, char** ARGV) {
// check if the array is empty
smallArrayt *dp = getG(dependencies, rtSmallArrayt, ssGet(depName));
if (not isEmptyG(dp)) {
- pushG(depStack, dp);
+ pErrorNULL(pushG(depStack, dp));
smallArrayt *thisDeps = getNDupG(dependencies, rtSmallArrayt, ssGet(depName));
- appendNSmashG(deps, thisDeps);
+ pErrorNULL(appendNSmashG(deps, thisDeps));
}
finishG(dp);
}
@@ -1293,8 +1293,8 @@ int MAIN(int ARGC, char** ARGV) {
char *realCPath = catS(actualDir, "/", k);
char *buildCPath = catS(buildPath, "/", k);
// TODO free ^^ before continue and at the end
- iNormalizePath(&realCPath);
- iNormalizePath(&buildCPath);
+ pErrorNULL(iNormalizePath(&realCPath));
+ pErrorNULL(iNormalizePath(&buildCPath));
// detect c file is updated
// get modification time for c file k
struct stat cst;
@@ -1303,11 +1303,11 @@ int MAIN(int ARGC, char** ARGV) {
// check if object already exists in build path
if (isC(k)) {
- setS(buildCPath, -1, 'o');
+ pErrorNULL(setS(buildCPath, -1, 'o'));
}
else {
- setS(buildCPath, -2, 'o');
- setS(buildCPath, -1, 0);
+ pErrorNULL(setS(buildCPath, -2, 'o'));
+ pErrorNULL(setS(buildCPath, -1, 0));
}
//puts(buildCPath);
if (fileExists(buildCPath)) {
@@ -1324,10 +1324,10 @@ int MAIN(int ARGC, char** ARGV) {
// copy header dates to not recompile unecesserarily next time
// change dep files after all modified files are found
createSmallArray(headerInfo);
- pushG (&headerInfo, actualDir);
- pushNFreeG(&headerInfo, dupG(hDeps));
- pushG (&headerInfo, buildPath);
- pushG (©AllHeaderDatesToDep, &headerInfo);
+ pErrorNULL(pushG (&headerInfo, actualDir));
+ pErrorNULL(pushNFreeG(&headerInfo, dupG(hDeps)));
+ pErrorNULL(pushG (&headerInfo, buildPath));
+ pErrorNULL(pushG (©AllHeaderDatesToDep, &headerInfo));
free(buildCPath);
continue;
}
@@ -1341,14 +1341,14 @@ int MAIN(int ARGC, char** ARGV) {
// get modification time for header
struct stat hst;
dum = catS(actualDir, "/", k);
- setS(dum, -1, 'h');
+ pErrorNULL(setS(dum, -1, 'h'));
if (fileExists(dum)) {
pError(stat(dum, &hst))
free(dum);
// get modification time for dep file
dum = catS(buildPath, "/", k, ".dep");
- setS(dum, -5, 'h');
+ pErrorNULL(setS(dum, -5, 'h'));
//logVarG(k);
//logVarG(dum);
if (fileExists(dum)) {
@@ -1362,10 +1362,10 @@ int MAIN(int ARGC, char** ARGV) {
// copy header dates to not recompile unecesserarily next time
// change dep files after all modified files are found
createSmallArray(headerInfo);
- pushG (&headerInfo, actualDir);
- pushNFreeG(&headerInfo, dupG(hDeps));
- pushG (&headerInfo, buildPath);
- pushG (©AllHeaderDatesToDep, &headerInfo);
+ pErrorNULL(pushG (&headerInfo, actualDir));
+ pErrorNULL(pushNFreeG(&headerInfo, dupG(hDeps)));
+ pErrorNULL(pushG (&headerInfo, buildPath));
+ pErrorNULL(pushG (©AllHeaderDatesToDep, &headerInfo));
free(buildCPath);
free(dum);
continue;
@@ -1383,10 +1383,10 @@ int MAIN(int ARGC, char** ARGV) {
// copy header dates to not recompile unecesserarily next time
// change dep files after all modified files are found
createSmallArray(headerInfo);
- pushG (&headerInfo, actualDir);
- pushNFreeG(&headerInfo, dupG(hDeps));
- pushG (&headerInfo, buildPath);
- pushG (©AllHeaderDatesToDep, &headerInfo);
+ pErrorNULL(pushG (&headerInfo, actualDir));
+ pErrorNULL(pushNFreeG(&headerInfo, dupG(hDeps)));
+ pErrorNULL(pushG (&headerInfo, buildPath));
+ pErrorNULL(pushG (©AllHeaderDatesToDep, &headerInfo));
free(buildCPath);
continue;
}
@@ -1425,19 +1425,19 @@ int MAIN(int ARGC, char** ARGV) {
if (!hasG(depName, PACKAGE_DIR)) {
char *cfile = dupG(depName);
if (isH(cfile)) {
- setG(cfile, -1, 'c');
+ pErrorNULL(setG(cfile, -1, 'c'));
}
else {
- setG(cfile, -1, 'p');
+ pErrorNULL(setG(cfile, -1, 'p'));
}
if (fileExists(cfile)) {
char *buildCPathForH = catS(buildPath, "/", cfile);
if (isC(k)) {
- setS(buildCPathForH, -1, 'o');
+ pErrorNULL(setS(buildCPathForH, -1, 'o'));
}
else {
- setS(buildCPathForH, -2, 'o');
- setS(buildCPathForH, -1, 0);
+ pErrorNULL(setS(buildCPathForH, -2, 'o'));
+ pErrorNULL(setS(buildCPathForH, -1, 0));
}
addFileToCompile(actualDir, cfile, buildCPathForH, toCompile);
free(buildCPathForH);
@@ -1533,10 +1533,10 @@ int MAIN(int ARGC, char** ARGV) {
}
if (isH(ssGet(L))) {
- setG(L, -1, 'c');
+ pErrorNULL(setG(L, -1, 'c'));
}
else {
- setG(L, -1, 'p');
+ pErrorNULL(setG(L, -1, 'p'));
}
if (!fileExistsO(L)) {
@@ -1550,15 +1550,15 @@ int MAIN(int ARGC, char** ARGV) {
char *oPath;
if (isC(ssGet(L))) {
- setG(L, -1, 'o');
+ pErrorNULL(setG(L, -1, 'o'));
oPath = catS(buildPath, "/", ssGet(L));
// restore c extension
- setG(L, -1, 'c');
+ pErrorNULL(setG(L, -1, 'c'));
}
else {
char *tmp = toStringG(L);
- setS(tmp, -2, 'o');
- setS(tmp, -1, 0);
+ pErrorNULL(setS(tmp, -2, 'o'));
+ pErrorNULL(setS(tmp, -1, 0));
oPath = catS(buildPath, "/", tmp);
free(tmp);
}
@@ -1613,7 +1613,7 @@ int MAIN(int ARGC, char** ARGV) {
if (isCP(*src)) {
// convert cp to c
char *bpath = catS(buildPath, "/", *src);
- setS(bpath, -1, 0);
+ pErrorNULL(setS(bpath, -1, 0));
// generate c
generateC(*src, bpath);
//copy(*src, bpath);
@@ -1626,10 +1626,10 @@ int MAIN(int ARGC, char** ARGV) {
castS(depName, dep)
if (isCH(ssGet(depName))) {
bpath = catS(buildPath, "/", ssGet(depName));
- setS(bpath, -2, 'h');
- setS(bpath, -1, 0);
+ pErrorNULL(setS(bpath, -2, 'h'));
+ pErrorNULL(setS(bpath, -1, 0));
// generate h
- copy(ssGet(depName), bpath);
+ pError0(copy(ssGet(depName), bpath));
free(bpath);
}
finishG(dep);
@@ -1643,10 +1643,10 @@ int MAIN(int ARGC, char** ARGV) {
castS(hFilename, INCF);
if (isCH(ssGet(hFilename))) {
char *bpath = catS(buildPath, "/", ssGet(hFilename));
- setS(bpath, -2, 'h');
- setS(bpath, -1, 0);
+ pErrorNULL(setS(bpath, -2, 'h'));
+ pErrorNULL(setS(bpath, -1, 0));
// generate h
- copy(ssGet(hFilename), bpath);
+ pError0(copy(ssGet(hFilename), bpath));
free(bpath);
}
finishG(INCF);
@@ -1663,19 +1663,19 @@ int MAIN(int ARGC, char** ARGV) {
// TODO use another variable, keep dir as the path to the original main src from the command line argument
// because dir is used to find the packages
// the new variable should be used in the compile commands below
- iPrependS(&dir, "/");
- iPrependS(&dir, buildPath);
+ pErrorNULL(iPrependS(&dir, "/"));
+ pErrorNULL(iPrependS(&dir, buildPath));
}
// create object path for main file to compile and link program
char *mainOPath = catS(buildPath, "/", mainSrc);
if (isC(mainSrc)) {
- setS(mainOPath, -1, 'o');
+ pErrorNULL(setS(mainOPath, -1, 'o'));
}
else {
// cp file
- setS(mainOPath, -2, 'o');
- setS(mainOPath, -1, 0);
+ pErrorNULL(setS(mainOPath, -2, 'o'));
+ pErrorNULL(setS(mainOPath, -1, 0));
}
@@ -1734,7 +1734,7 @@ int MAIN(int ARGC, char** ARGV) {
// delete existing executable in buildPath
// to avoid running an old executable when the compilation fails
if (fileExists(buildExePath)) {
- rmAll(buildExePath);
+ pError0(rmAll(buildExePath));
}
// setup cflags key depending on the options: -c cflags, -t testCflags, -m memcheckCflags
@@ -1780,9 +1780,9 @@ int MAIN(int ARGC, char** ARGV) {
if (hasG(cfgD, cflagsAlwaysKey) && !isBlankG(getG(cfgD, rtChar, cflagsAlwaysKey))) {
if (!isBlankG(cflags)) {
- prependG(&cflags, ' ');
+ pErrorNULL(prependG(&cflags, ' '));
}
- prependG(&cflags, getG(cfgD, rtChar, cflagsAlwaysKey));
+ pErrorNULL(prependG(&cflags, getG(cfgD, rtChar, cflagsAlwaysKey)));
}
//logVarG(cflags);
@@ -1839,32 +1839,32 @@ int MAIN(int ARGC, char** ARGV) {
else {
// cp file has been converted to c in buildPath
cpath = catS(buildPath, "/", *src);
- setS(cpath, -1, 0);
+ pErrorNULL(setS(cpath, -1, 0));
oPath = strdup(cpath);
}
- setS(oPath, -1, 'o');
+ pErrorNULL(setS(oPath, -1, 'o'));
// create compile command and run with system
createAllocateSmallArray(ccmdL);
- pushG(ccmdL, subcc);
+ pErrorNULL(pushG(ccmdL, subcc));
char *buildMirrorD;
// macOS: touch object to avoid error in macOS
buildMirrorD = catS("touch ", oPath);
char *D = shDirname(oPath);
- mkdirParents(D);
+ pError0(mkdirParents(D));
free(D);
programResult += commandNFree(buildMirrorD);
buildMirrorD = shDirname(oPath);
if (!fileExists(buildMirrorD)) {
// create c file dir in homedir/build
- mkdirParents(buildMirrorD);
+ pError0(mkdirParents(buildMirrorD));
}
free(buildMirrorD);
pushNFreeG(ccmdL, oPath);
- pushG(ccmdL, cpath);
+ pErrorNULL(pushG(ccmdL, cpath));
char *ccmd = joinSG(ccmdL, " ");
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("%s\n", ccmd);
@@ -1877,7 +1877,7 @@ int MAIN(int ARGC, char** ARGV) {
terminateG(ccmdL);
// remove possible empty strings due to split before
- iListCompactS(&jobArgs);
+ pErrorNULL(iListCompactS(&jobArgs));
spawnProc(childProc, jobArgs);
listFreeS(jobArgs);
}
@@ -1920,12 +1920,12 @@ int MAIN(int ARGC, char** ARGV) {
// the packages are already compiled
// use the static library
if (isH(ssGet(L))) {
- setS(s, -1, 'a');
+ pErrorNULL(setS(s, -1, 'a'));
}
else {
// L is .ch extension
- setS(s, -2, 'a');
- setS(s, -1, 0);
+ pErrorNULL(setS(s, -2, 'a'));
+ pErrorNULL(setS(s, -1, 0));
}
// the path in L can contain subdirectories in the package
// shpPackages/ini/src/ini.a
@@ -1947,13 +1947,13 @@ int MAIN(int ARGC, char** ARGV) {
}
// keep package name and delete subdirectories
- delG(arr, keepIndex+2, -1);
+ pErrorNULL(delG(arr, keepIndex+2, -1));
//logVarG(arr);
free(s);
// add path to main file to be able to run program from any
// directory
- prependG(arr, dir);
+ pErrorNULL(prependG(arr, dir));
s = joinSG(arr, "/");
terminateG(arr);
if (!fileExists(s)) {
@@ -1965,12 +1965,12 @@ int MAIN(int ARGC, char** ARGV) {
// collect lflags for this package
char *pkg = shDirnameG(s);
- iAppendManyS(&pkg, "/", PACKAGE);
+ pErrorNULL(iAppendManyS(&pkg, "/", PACKAGE));
//logVarG(pkg);
createAllocateSmallJson(pkgJ);
if (readFileG(pkgJ, pkg)) {
if (!isBlankG(getG(pkgJ, rtChar, "lflags"))) {
- iAppendManyS(&packageLflags, " ", getG(pkgJ, rtChar, "lflags"));
+ pErrorNULL(iAppendManyS(&packageLflags, " ", getG(pkgJ, rtChar, "lflags")));
}
}
free(pkg);
@@ -1979,11 +1979,11 @@ int MAIN(int ARGC, char** ARGV) {
else {
// it is allowed to include an h without a corresponding c file
if (isH(ssGet(L))) {
- setG(L, -1, 'c');
+ pErrorNULL(setG(L, -1, 'c'));
}
else {
// L is .ch extension
- setS(s, -1, 'p');
+ pErrorNULL(setS(s, -1, 'p'));
}
dum = catS(actualDir, "/", ssGet(L));
if (!fileExistsG(dum)) {
@@ -1995,15 +1995,15 @@ int MAIN(int ARGC, char** ARGV) {
free(dum);
if (isC(ssGet(L))) {
- setS(s, -1, 'o');
+ pErrorNULL(setS(s, -1, 'o'));
}
else {
// L is .ch extension
- setS(s, -2, 'o');
- setS(s, -1, 0);
+ pErrorNULL(setS(s, -2, 'o'));
+ pErrorNULL(setS(s, -1, 0));
}
- iPrependS(&s, "/");
- iPrependS(&s, buildPath);
+ pErrorNULL(iPrependS(&s, "/"));
+ pErrorNULL(iPrependS(&s, buildPath));
}
if (getG(s, unusedV, -1) == 'a') {
pushNFreeG(aLibPackages, s);
@@ -2029,14 +2029,14 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm %s", mainCPath);
printf("\n");
}
- rmAll(mainCPath);
+ pError0(rmAll(mainCPath));
}
if (fileExistsG(mainOPath)) {
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("rm %s", mainOPath);
printf("\n");
}
- rmAll(mainOPath);
+ pError0(rmAll(mainOPath));
}
if (getG(cfgD, rtBool, "clean_exe")) {
// delete executable or library (.a and .so)
@@ -2046,7 +2046,7 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm %s", exePath);
printf("\n");
}
- rmAll(exePath);
+ pError0(rmAll(exePath));
}
char *libname = appendS(rootMain, ".so");
if (fileExists(libname)) {
@@ -2054,7 +2054,7 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm %s", libname);
printf("\n");
}
- rmAll(libname);
+ pError0(rmAll(libname));
}
free(libname);
libname = appendS(rootMain, ".a");
@@ -2063,7 +2063,7 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm %s", libname);
printf("\n");
}
- rmAll(libname);
+ pError0(rmAll(libname));
}
free(libname);
}
@@ -2083,7 +2083,7 @@ int MAIN(int ARGC, char** ARGV) {
printf("rm %s", ssGet(L));
printf("\n");
}
- rmAll(ssGet(L));
+ pError0(rmAll(ssGet(L)));
}
finishG(L);
}
@@ -2142,7 +2142,7 @@ int MAIN(int ARGC, char** ARGV) {
lflags = dupG(lflags);
if (!isBlankG(packageLflags)) {
- appendG(&lflags, packageLflags);
+ pErrorNULL(appendG(&lflags, packageLflags));
free(packageLflags);
}
//logVarG(lflags);
@@ -2261,7 +2261,7 @@ int MAIN(int ARGC, char** ARGV) {
// copy exe
if (isEmptyS(run) && !sheepyParams.dontCompileExe) {
// copy it to main source folder
- copy(buildExePath, exePath);
+ pError0(copy(buildExePath, exePath));
if (!sheepyParams.clean) {
if (programResult) {
dum = BLD UDL BGYLW RED"Failed to build Executable:"RST" %s\n";
@@ -2360,7 +2360,7 @@ void copyHeaderToBuildPath(char *bPath, struct stat hst) {
// the h.dep hold the modification time of the original header
char *tmp = catS("touch ", bPath, ".dep");
char *D = shDirname(bPath);
- mkdirParents(D);
+ pError0(mkdirParents(D));
free(D);
programResult += commandNFree(tmp);
@@ -2391,7 +2391,7 @@ void copyHeaderDates(char *actualDir, smallArrayt *hDeps, char *buildPath) {
// 'copy' header to build path, to check modification time next time
tmp = catS("touch ", bPath);
char *D = shDirname(bPath);
- mkdirParents(D);
+ pError0(mkdirParents(D));
free(D);
programResult += commandNFree(tmp);
@@ -2410,7 +2410,7 @@ bool symlinkFile(char *path, char *buildPath) {
if (!fileExists(buildPath)) {
// symlink (h) file
char *D = shDirname(buildPath);
- mkdirParents(D);
+ pError0(mkdirParents(D));
free(D);
char *cmd = catS("ln -s ", path, " ", buildPath);
programResult += commandNFree(cmd);
@@ -2469,7 +2469,7 @@ void generateC(char *src, char *bpath) {
generateCBuffers(sheepySrc, cCode);
- writeFileG(cCode, bpath);
+ pError0(writeFileG(cCode, bpath));
terminateG(sheepySrc);
terminateG(cCode);
diff --git a/src/spm.c b/src/spm.c
@@ -157,11 +157,11 @@ int MAIN(int ARGC, char** ARGV) {
printf(" The local package repository is located in " UDL "%s" RST "\n", localPackageDir);
if (dum) {
var tmp = catS(getG(cfgD, rtChar, "system"), "/", PACKAGE_DIR);
- bUniqSlash(tmp);
+ pErrorNULL(bUniqSlash(tmp));
printf(" The global package repository is located in " UDL "%s" RST "\n", tmp);
free(tmp);
tmp = catS(getG(cfgD, rtChar, "system"), "/bin");
- bUniqSlash(tmp);
+ pErrorNULL(bUniqSlash(tmp));
printf(" Commands from packages are added in " UDL "%s" RST "\n", tmp);
free(tmp);
}
@@ -361,7 +361,7 @@ int MAIN(int ARGC, char** ARGV) {
goto newPassword;
}
// clear password from memory
- zeroS(cpassword);
+ pError0(zeroS(cpassword));
free(cpassword);
newEmail:
@@ -381,17 +381,17 @@ int MAIN(int ARGC, char** ARGV) {
char *hash = sha256S(password);;
// clear password from memory
- zeroS(password);
+ pError0(zeroS(password));
free(password);
createAllocateSmallJson(json);
- setG(json, "method", "adduser");
+ pErrorNULL(setG(json, "method", "adduser"));
createSmallArray(a);
- pushG(&a, username);
- pushG(&a, hash);
- pushG(&a, email);
- pushG(&a, name);
- setG(json, "params", &a);
+ pErrorNULL(pushG(&a, username));
+ pErrorNULL(pushG(&a, hash));
+ pErrorNULL(pushG(&a, email));
+ pErrorNULL(pushG(&a, name));
+ pErrorNULL(setG(json, "params", &a));
freeManyS(username, hash, email, name);
@@ -419,15 +419,15 @@ int MAIN(int ARGC, char** ARGV) {
char *hash = sha256S(password);;
// clear password from memory
- zeroS(password);
+ pError0(zeroS(password));
free(password);
createAllocateSmallJson(json);
- setG(json, "method", "apikey");
+ pErrorNULL(setG(json, "method", "apikey"));
createSmallArray(ar);
- pushG(&ar, username);
- pushG(&ar, hash);
- setG(json, "params", &ar);
+ pErrorNULL(pushG(&ar, username));
+ pErrorNULL(pushG(&ar, hash));
+ pErrorNULL(setG(json, "params", &ar));
freeManyS(username, hash);
@@ -447,8 +447,8 @@ int MAIN(int ARGC, char** ARGV) {
}
createAllocateSmallJson(json);
- setG(json, "method", "whoami");
- setG(json, "key", key);
+ pErrorNULL(setG(json, "method", "whoami"));
+ pErrorNULL(setG(json, "key", key));
char **result = requestRegistry(cfgD, json);
// result=[{"username":"remy","name":"Remy Noulin","publicemail":"eqw@wdqd"}]
@@ -465,8 +465,8 @@ int MAIN(int ARGC, char** ARGV) {
}
createAllocateSmallJson(json);
- setG(json, "method", "profile");
- setNFreeG(json, "params", dupG(options));
+ pErrorNULL(setG(json, "method", "profile"));
+ pErrorNULL(setNFreeG(json, "params", dupG(options)));
char **result = requestRegistry(cfgD, json);
//result=[{"username":"remy","name":"Remy Noulin","publicemail":"eqw@wdqd","packages":["aCmd","cfp","cpy","here","dmce","forest","inotify","mkparents","mve","normalize","easydoneitCTui","searchReplace","sheepyExamples","md4c","preprocessor","md","files","dog","pp","ini","liveserver"]}]
@@ -489,9 +489,9 @@ int MAIN(int ARGC, char** ARGV) {
}
createAllocateSmallJson(json);
- setG(json, "method", "unpublish");
- setNFreeG(json, "params", dupG(options));
- setG(json, "key", key);
+ pErrorNULL(setG(json, "method", "unpublish"));
+ pErrorNULL(setNFreeG(json, "params", dupG(options)));
+ pErrorNULL(setG(json, "key", key));
char **result = requestRegistry(cfgD, json);
// result=["TT","simpleTemplates"]
@@ -508,8 +508,8 @@ int MAIN(int ARGC, char** ARGV) {
}
createAllocateSmallJson(json);
- setG(json, "method", "info");
- setNFreeG(json, "params", dupG(options));
+ pErrorNULL(setG(json, "method", "info"));
+ pErrorNULL(setNFreeG(json, "params", dupG(options)));
char **result = requestRegistry(cfgD, json);
showPackageListFromRegistry(result, json);
@@ -520,7 +520,7 @@ int MAIN(int ARGC, char** ARGV) {
if (params.top) {
createAllocateSmallJson(json);
- setG(json, "method", "top");
+ pErrorNULL(setG(json, "method", "top"));
char **result = requestRegistry(cfgD, json);
showPackageListFromRegistry(result, json);
@@ -531,7 +531,7 @@ int MAIN(int ARGC, char** ARGV) {
if (params.hot) {
createAllocateSmallJson(json);
- setG(json, "method", "hot");
+ pErrorNULL(setG(json, "method", "hot"));
char **result = requestRegistry(cfgD, json);
showPackageListFromRegistry(result, json);
@@ -542,7 +542,7 @@ int MAIN(int ARGC, char** ARGV) {
if (params.latest) {
createAllocateSmallJson(json);
- setG(json, "method", "latest");
+ pErrorNULL(setG(json, "method", "latest"));
char **result = requestRegistry(cfgD, json);
showPackageListFromRegistry(result, json);
@@ -557,12 +557,12 @@ int MAIN(int ARGC, char** ARGV) {
XFAILURE
}
createAllocateSmallJson(json);
- setG(json, "method", "find");
+ pErrorNULL(setG(json, "method", "find"));
// put options in a string in an array
createAllocateSmallArray(a);
- pushNFreeG(a, joinG(options, ' '));
- setNFreeG(json, "params", a);
+ pErrorNULL(pushNFreeG(a, joinG(options, ' ')));
+ pErrorNULL(setNFreeG(json, "params", a));
//logVarG(json);
char **result = requestRegistry(cfgD, json);
@@ -581,11 +581,11 @@ int MAIN(int ARGC, char** ARGV) {
iter(options, O) {
castS(o, O);
- mkdirParentsG(o);
- chDirG(o);
+ pError0(mkdirParentsG(o));
+ pError0(chDirG(o));
sourceFromTemplate(ssGet(o));
pkgFromTemplate(ssGet(o));
- chDirG("..");
+ pError0(chDirG(".."));
}
XSUCCESS
}
@@ -741,24 +741,24 @@ int MAIN(int ARGC, char** ARGV) {
initiateG(&pkgDeps);
forEachS(installedPackages, pkg) {
// add pkg to dependency list in package.yml
- setG(pkgDeps, pkg, "");
+ pErrorNULL(setG(pkgDeps, pkg, ""));
printf("Added %s to dependencies", pkg);
printf("\n");
}
- setNFreeG(&pkgInfo, "dependencies", pkgDeps);
+ pErrorNULL(setNFreeG(&pkgInfo, "dependencies", pkgDeps));
}
else {
forEachS(installedPackages, pkg) {
if (not hasG(pkgDeps, pkg)) {
// add pkg to dependency list in package.yml
- setG(pkgDeps, pkg, "");
+ pErrorNULL(setG(pkgDeps, pkg, ""));
printf("Added %s to dependencies", pkg);
printf("\n");
}
}
- setNFreePG(&pkgInfo, "dependencies", pkgDeps);
+ pErrorNULL(setNFreePG(&pkgInfo, "dependencies", pkgDeps));
}
- writeFileG(&pkgInfo, PACKAGE);
+ pError0(writeFileG(&pkgInfo, PACKAGE));
freeG(&pkgInfo);
}
listFreeS(installedPackages);
@@ -961,7 +961,7 @@ void publish(smallDictt *cfgD, bool pigz) {
if (getG(cfgD, bum, "print_compile_commands")) {
printf("%s\n", cmd);
}
- systemNFreeG(cmd);
+ pError0(systemNFreeG(cmd));
terminateG(d);
}
@@ -979,15 +979,15 @@ void installPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options, bool
packageDir = catS(getG(cfgD, rtChar, "system") , "/", PACKAGE_DIR);
}
- iExpandHome(&packageDir);
+ pErrorNULL(iExpandHome(&packageDir));
// create package folder
if (!fileExists(packageDir)) {
- mkdirParents(packageDir);
+ pError0(mkdirParents(packageDir));
}
char *cwd = getCwd();
- chDir(packageDir);
+ pError0(chDir(packageDir));
//logVarG(options);
@@ -999,9 +999,9 @@ void installPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options, bool
printf("installing current package %s\n", cwd);
char *pkgName = strdup(basename(cwd));
if (isDir(pkgName)) {
- rmAll(pkgName);
+ pError0(rmAll(pkgName));
}
- copy(cwd, packageDir);
+ pError0(copy(cwd, packageDir));
compilePackage(pkgName, isGlobal, cfgD, "version");
free(pkgName);
}
@@ -1024,7 +1024,7 @@ void installPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options, bool
}
}
- chDir(cwd);
+ pError0(chDir(cwd));
free(cwd);
// wait for the jobs to finish
@@ -1082,7 +1082,7 @@ void installAPackage(bool isGlobal, smallDictt *cfgD, smallStringt *o, bool pigz
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("%s\n", cmd);
}
- systemNFree(cmd);
+ pError0(systemNFree(cmd));
// detect download errors
char *s = catS(name, ".tar.gz");;
@@ -1092,7 +1092,7 @@ void installAPackage(bool isGlobal, smallDictt *cfgD, smallStringt *o, bool pigz
XFAILURE
}
char errorBuf[17];
- bLReadFileToS(s, errorBuf, sizeof(errorBuf));
+ pErrorNULL(bLReadFileToS(s, errorBuf, sizeof(errorBuf)));
if (startsWithG(errorBuf, "No version found") or startsWithG(errorBuf, "Internal Error.") or startsWithG(errorBuf, "package does not")) {
printf(BLD RED "Download error: %s not found" RST "\n", name);
free(s);
@@ -1110,7 +1110,7 @@ void installAPackage(bool isGlobal, smallDictt *cfgD, smallStringt *o, bool pigz
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("%s\n", cmd);
}
- systemNFreeG(cmd);
+ pError0(systemNFreeG(cmd));
// compile package
compilePackage(name, isGlobal, cfgD, currentVersion);
@@ -1137,11 +1137,11 @@ void compilePackage(char *name, bool isGlobal, smallDictt *cfgD, char *currentVe
// remove extension
if (getS(tbin, -1) == 'c') {
// c extension
- setG(tbin, -2, 0);
+ pError0(setG(tbin, -2, 0));
}
else if (getS(tbin, -2) == 'c' && getS(tbin, -1) == 'p') {
// cp extension
- setG(tbin, -3, 0);
+ pError0(setG(tbin, -3, 0));
}
// is execautable or library: detect h file
char *h = catS(name, "/", tbin, ".h");
@@ -1212,7 +1212,7 @@ void compilePackage(char *name, bool isGlobal, smallDictt *cfgD, char *currentVe
// compile lib when there is 'bin'.h in the package
// the executable is stored in the package folder
cmd = catS(name, "/", bin);
- setS(cmd, -1, 'h');
+ pErrorNULL(setS(cmd, -1, 'h'));
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("%s\n", cmd);
}
@@ -1257,12 +1257,12 @@ void compilePackage(char *name, bool isGlobal, smallDictt *cfgD, char *currentVe
goto skipLink;
}
- iUniqSlash(cmd);
+ pErrorNULL(iUniqSlash(cmd));
if (getG(cfgD, rtBool, "print_compile_commands")) {
printf("%s\n", cmd);
}
- systemNFreeG(cmd);
+ pError0(systemNFreeG(cmd));
skipLink:
free(bin);
}
@@ -1301,22 +1301,22 @@ bool installDependencies(bool isGlobal, smallDictt *cfgD, smallDictt *d, const c
}
else {
// install dependencies inside current package
- chDir(name);
+ pError0(chDir(name));
// create PACKAGE_DIR shpPackages to install locally
- mkdirParents(PACKAGE_DIR);
+ pError0(mkdirParents(PACKAGE_DIR));
global = "";
}
forEachCharP(depsL, dep) {
cmd = listCreateS(argv[0], "install", global, *dep);
- iListCompactS(&cmd);
+ pErrorNULL(iListCompactS(&cmd));
if (getG(cfgD, rtBool, "print_compile_commands")) {
logNFree(join(cmd, " "));
}
// parallel has to be defined and 0 to disable parallel spm
if (hasG(cfgD, "parallelSpm") && !getG(cfgD, rtI32, "parallelSpm")) {
- systemNFreeG(join(cmd, " "));
+ pError0(systemNFreeG(join(cmd, " ")));
}
else {
spawnProcDeps(childProc, cmd);
@@ -1324,7 +1324,7 @@ bool installDependencies(bool isGlobal, smallDictt *cfgD, smallDictt *d, const c
listFreeS(cmd);
}
- chDir(cwd);
+ pError0(chDir(cwd));
free(cwd);
listFreeS(depsL);
finishG(deps);
@@ -1354,7 +1354,7 @@ int testPackage(smallDictt *cfgD, smallDictt *packageyml) {
// remove extension from testBin
if ((getS(bin, -2) == '.') and (getS(bin, -1) == 'c')) {
- setS(bin, -2, 0);
+ pErrorNULL(setS(bin, -2, 0));
}
if (getG(cfgD, rtBool, "print_compile_commands")) {
@@ -1367,7 +1367,7 @@ int testPackage(smallDictt *cfgD, smallDictt *packageyml) {
printf("rm %s", bin);
printf("\n");
}
- rmAll(bin);
+ pError0(rmAll(bin));
}
}
@@ -1418,7 +1418,7 @@ void memcheckPackage(smallDictt *cfgD, smallDictt *packageyml) {
// remove extension from memcheckBin
if ((getS(bin, -2) == '.') and (getS(bin, -1) == 'c')) {
- setS(bin, -2, 0);
+ pErrorNULL(setS(bin, -2, 0));
}
// TODO due to a weird bug in debian stretch 180324, I run memcheckBin before running it again with valgrind
@@ -1435,7 +1435,7 @@ void memcheckPackage(smallDictt *cfgD, smallDictt *packageyml) {
printf("rm %s", bin);
printf("\n");
}
- rmAll(bin);
+ pError0(rmAll(bin));
}
exit(r);
@@ -1487,7 +1487,7 @@ void asanPackage(smallDictt *cfgD, smallDictt *packageyml) {
// remove extension from asanBin
if ((getS(bin, -2) == '.') and (getS(bin, -1) == 'c')) {
- setS(bin, -2, 0);
+ pErrorNULL(setS(bin, -2, 0));
}
if (getG(cfgD, rtBool, "print_compile_commands")) {
@@ -1502,7 +1502,7 @@ void asanPackage(smallDictt *cfgD, smallDictt *packageyml) {
printf("rm %s", bin);
printf("\n");
}
- rmAll(bin);
+ pError0(rmAll(bin));
}
exit(r);
@@ -1517,12 +1517,12 @@ void listAllPackages(smallDictt *cfgD, smallArrayt *options) {
}
smallStringt *path = createS(getG(cfgD, rtChar, "system") , "/", PACKAGE_DIR);
normalizePathG(path);
- expandHomeG(path);
+ pErrorNULL(expandHomeG(path));
if (isDirG(path)) {
appendNSmashG(options, readDirDirG(rtSmallArrayt, ssGet(path)));
}
terminateG(path);
- uniqG(options, unusedV);
+ pErrorNULL(uniqG(options, unusedV));
}
void showPackage(smallDictt *cfgD, smallStringt *o) {
@@ -1541,7 +1541,7 @@ void showPackage(smallDictt *cfgD, smallStringt *o) {
path = createS(getG(cfgD, rtChar, "system") , "/", PACKAGE_DIR, "/", ssGet(o), "/", PACKAGE);
normalizePathG(path);
- expandHomeG(path);
+ pErrorNULL(expandHomeG(path));
if (fileExistsG(path)) {
puts(BLD WHT "GLOBAL" RST);
showPackageInfo(path);
@@ -1604,7 +1604,7 @@ void updatePackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options, bool
path = createS(getG(cfgD, rtChar, "system") , "/", PACKAGE_DIR, "/", ssGet(o), "/", PACKAGE);
normalizePathG(path);
- expandHomeG(path);
+ pErrorNULL(expandHomeG(path));
// update all packages even those that are not yet installed
pushG(packagesToUpdate, o);
@@ -1631,7 +1631,7 @@ void uninstallPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options) {
packageDir = catS(getG(cfgD, rtChar, "system") , "/", PACKAGE_DIR);
}
- iExpandHome(&packageDir);
+ pErrorNULL(iExpandHome(&packageDir));
// skip when package folder is not found
if (!fileExists(packageDir)) {
@@ -1639,7 +1639,7 @@ void uninstallPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options) {
}
cwd = getCwd();
- chDir(packageDir);
+ pError0(chDir(packageDir));
//logVarG(options);
@@ -1671,9 +1671,9 @@ void uninstallPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options) {
if (getG(cfgD, rtBool, "print_compile_commands")) {
putsG(cmd);
}
- chDir(name);
- systemNFreeG(cmd);
- chDir("..");
+ pError0(chDir(name));
+ pError0(systemNFreeG(cmd));
+ pError0(chDir(".."));
// uninstall dependencies
}
@@ -1690,13 +1690,13 @@ void uninstallPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options) {
char **rootBin_l = split(pkgBin, ".");
char *rootBin = rootBin_l[0];
char *path = catS("../bin/", rootBin);;
- rmAll(path);
+ pError0(rmAll(path));
free(path);
free(pkgBin);
listFreeS(rootBin_l);
}
- rmAll(name);
+ pError0(rmAll(name));
terminateG(d);
free(path);
@@ -1704,12 +1704,12 @@ void uninstallPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options) {
end:
terminateG(spl);
}
- chDir(cwd);
+ pError0(chDir(cwd));
free(cwd);
smallArrayt *arr = readDirDirO(packageDir);;
if (!lenG(arr) && !isGlobal) {
// remove empty shpPackages
- rmAll(packageDir);
+ pError0(rmAll(packageDir));
}
terminateG(arr);
free(packageDir);
@@ -1834,7 +1834,7 @@ char **requestRegistry(smallDictt *cfgD, smallJsont *json) {
}
char **result = execOut(cmd);;
free(cmd);
- rmAll(reqFile);
+ pError0(rmAll(reqFile));
free(reqFile);
return(result);