Skip to content

Commit

Permalink
kernel: replace exit() calls by Panic or SyExit
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 19, 2018
1 parent 7835f42 commit 32fc058
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
10 changes: 3 additions & 7 deletions src/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ void InformProfilingThatThisIsAForkedGAP(void)
// Allow 20 chracters to allow space for .%d.gz
const int SUPPORTED_PATH_LEN = GAP_PATH_MAX - 20;
if(strlen(profileState.filename) > SUPPORTED_PATH_LEN) {
Pr("Filename can be at most %d character when forking", SUPPORTED_PATH_LEN, 0L);
SyExit(1);
Panic("Filename can be at most %d character when forking", SUPPORTED_PATH_LEN);
}
if (endsWithgz(profileState.filename)) {
snprintf(filenamecpy, sizeof(filenamecpy), "%.*s.%d.gz",
Expand Down Expand Up @@ -599,17 +598,14 @@ struct InterpreterHooks profileHooks = { visitStat,
void enableAtStartup(char * filename, Int repeats, TickMethod tickMethod)
{
if(profileState_Active) {
fprintf(stderr, "-P or -C can only be passed once\n");
exit(1);
Panic("-P or -C can only be passed once\n");
}

profileState.OutputRepeats = repeats;

fopenMaybeCompressed(filename, &profileState);
if(!profileState.Stream) {
fprintf(stderr, "Failed to open '%s' for profiling output.\n", filename);
fprintf(stderr, "Abandoning starting GAP.\n");
exit(1);
Panic("Failed to open '%s' for profiling output.\n", filename);
}

strlcpy(profileState.filename, filename, GAP_PATH_MAX);
Expand Down
7 changes: 2 additions & 5 deletions src/saveload.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,8 @@ static void LoadBagData ( void )
flags = LoadUInt1();
size = LoadUInt();

if (TNAM_TNUM(type) == NULL)
{
Pr("Bad type %d, size %d\n",type,size);
exit(1);
}
if (TNAM_TNUM(type) == NULL)
Panic("Bad type %d, size %d\n", (int)type, (int)size);

/* Get GASMAN to set up the bag for me */
bag = NextBagRestoring( type, flags, size );
Expand Down
2 changes: 1 addition & 1 deletion src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ void Panic_(const char * file, int line, const char * fmt, ...)
vfprintf(stderr, fmt, args);
va_end (args);
fputs("\n", stderr);
exit(1);
SyExit(1);
}


Expand Down

0 comments on commit 32fc058

Please sign in to comment.