Skip to content

Commit

Permalink
Better error "Sorted function argument too long"
Browse files Browse the repository at this point in the history
Print the required MaxTermSize in words to allow easy configuration of setup.
  • Loading branch information
Joshua Davies committed Aug 12, 2018
1 parent e8c9798 commit 6ca4aca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sources/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,13 @@ LONG EndSort(PHEAD WORD *buffer, int par)
while ( ( t = *ss++ ) != 0 ) {
j = *t;
if ( ( sSpace += j ) > AM.MaxTer/((LONG)sizeof(WORD)) ) {
/* Too big! Get the total size for useful error message */
while ( ( t = *ss++ ) != 0 ) {
sSpace += *t;
}
MLOCK(ErrorMessageLock);
MesPrint("Sorted function argument too long.");
MesPrint("Sorted function argument too long: %d words", sSpace);
MesPrint("MaxTermSize: %d words", AM.MaxTer/((LONG)sizeof(WORD)) );
MUNLOCK(ErrorMessageLock);
retval = -1; goto RetRetval;
}
Expand Down
1 change: 1 addition & 0 deletions sources/tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,7 @@ VOID *Malloc1(LONG size, const char *messageifwrong)
#ifndef MALLOCDEBUG
MLOCK(ErrorMessageLock);
#endif
MesPrint("Attempted to allocate %l bytes.", size);
Error1("No memory while allocating ",(UBYTE *)messageifwrong);
#ifndef MALLOCDEBUG
MUNLOCK(ErrorMessageLock);
Expand Down

0 comments on commit 6ca4aca

Please sign in to comment.