Commit 46800d1b authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Replace sprintf of debug messages with xabort varargs.

parent 3403628f
...@@ -31,7 +31,6 @@ extern char * command2charP[6]; ...@@ -31,7 +31,6 @@ extern char * command2charP[6];
extern long initial_buffersize; extern long initial_buffersize;
extern char *token; extern char *token;
extern int maxErrorString;
extern double accumProbe; extern double accumProbe;
extern double accumRecv; extern double accumRecv;
...@@ -116,7 +115,6 @@ static bFiledataPA *initBFiledataPA ( char *filename, ...@@ -116,7 +115,6 @@ static bFiledataPA *initBFiledataPA ( char *filename,
{ {
bFiledataPA *bfd; bFiledataPA *bfd;
int i; int i;
char errorString[maxErrorString];
xdebug ( "filename=%s, buffersize=%zu, ncollectors=%d, nPrefetchStreams=%d", xdebug ( "filename=%s, buffersize=%zu, ncollectors=%d, nPrefetchStreams=%d",
filename, bs, nc, nPrefStreams ); filename, bs, nc, nPrefStreams );
...@@ -128,10 +126,7 @@ static bFiledataPA *initBFiledataPA ( char *filename, ...@@ -128,10 +126,7 @@ static bFiledataPA *initBFiledataPA ( char *filename,
bfd->size = bs; bfd->size = bs;
if (( bfd->handle = open ( bfd->name, O_CREAT | O_WRONLY, 0666 )) == -1 ) if (( bfd->handle = open ( bfd->name, O_CREAT | O_WRONLY, 0666 )) == -1 )
{ xabort("Failed to open %s", bfd->name);
sprintf ( errorString, "Failed to open %s", bfd->name );
xabort ( errorString );
}
dbuffer_init ( &( bfd->fb ), ( size_t )( nPrefStreams * bfd->size )); dbuffer_init ( &( bfd->fb ), ( size_t )( nPrefStreams * bfd->size ));
...@@ -347,25 +342,16 @@ void queueCheckPA ( queue_t *q, char *name ) ...@@ -347,25 +342,16 @@ void queueCheckPA ( queue_t *q, char *name )
{ {
listElem_t *curr; listElem_t *curr;
bFiledataPA *bfd; bFiledataPA *bfd;
size_t len;
char errorString[maxErrorString]; curr = q->head;
len = strlen ( name );
curr = q->head;
while ( curr ) while ( curr )
{ {
bfd = ( bFiledataPA * ) curr->val; bfd = ( bFiledataPA * ) curr->val;
if ( len == strlen ( bfd->name ) && if (strcmp(name, bfd->name) == 0)
memcmp ( name, bfd->name, len ) == 0 ) xabort("Filename %s is already enqueued\n", name );
{
sprintf ( errorString, "Filename %s is already enqueued\n", name );
xabort ( errorString );
return;
}
curr = curr->next; curr = curr->next;
} }
} }
/***************************************************************/ /***************************************************************/
...@@ -613,7 +599,6 @@ size_t fwPOSIXASYNCH( int id, int tsID, const void *buffer, size_t len ) ...@@ -613,7 +599,6 @@ size_t fwPOSIXASYNCH( int id, int tsID, const void *buffer, size_t len )
int filled = 0; int filled = 0;
aFiledataPA *afd; aFiledataPA *afd;
listElem_t *curr; listElem_t *curr;
char errorString[maxErrorString];
afd = ( aFiledataPA * ) queueIdx2val ( bibAFiledataPA, id ); afd = ( aFiledataPA * ) queueIdx2val ( bibAFiledataPA, id );
flush = ( tsID != afd->tsID ) ? 1 : 0; flush = ( tsID != afd->tsID ) ? 1 : 0;
...@@ -697,7 +682,6 @@ int fowPOSIXASYNCH ( const char *filename ) ...@@ -697,7 +682,6 @@ int fowPOSIXASYNCH ( const char *filename )
static long buffersize = 0; static long buffersize = 0;
int root = 0, iret, id, messageLength = 32; int root = 0, iret, id, messageLength = 32;
char message[messageLength]; char message[messageLength];
char errorString[maxErrorString];
/* broadcast buffersize to collectors */ /* broadcast buffersize to collectors */
...@@ -719,11 +703,8 @@ int fowPOSIXASYNCH ( const char *filename ) ...@@ -719,11 +703,8 @@ int fowPOSIXASYNCH ( const char *filename )
/* init and enqueue aFiledataPA */ /* init and enqueue aFiledataPA */
afd = initAFiledataPA ( filename, buffersize ); afd = initAFiledataPA ( filename, buffersize );
if (( id = queuePush ( bibAFiledataPA, afd, 0 )) < 0 ) if ((id = queuePush ( bibAFiledataPA, afd, 0)) < 0)
{ xabort("filename %s is not unique", afd->name);
sprintf ( errorString, "filename %s is not unique", afd->name );
xabort ( errorString );
}
xdebug ( "filename=%s, init and enqueued aFiledataPA, return id = %d", xdebug ( "filename=%s, init and enqueued aFiledataPA, return id = %d",
filename, id ); filename, id );
......
...@@ -19,7 +19,6 @@ extern char * command2charP[6]; ...@@ -19,7 +19,6 @@ extern char * command2charP[6];
extern long initial_buffersize; extern long initial_buffersize;
extern char *token; extern char *token;
extern int maxErrorString;
extern double accumProbe; extern double accumProbe;
extern double accumRecv; extern double accumRecv;
...@@ -101,7 +100,6 @@ static bFiledataP * initBFiledataP ( char *filename, ...@@ -101,7 +100,6 @@ static bFiledataP * initBFiledataP ( char *filename,
{ {
bFiledataP * bfp; bFiledataP * bfp;
int i; int i;
char errorString[maxErrorString];
xdebug ( "filename=%s, buffersize=%lu, ncollectors=%d", filename, bs, nc ); xdebug ( "filename=%s, buffersize=%lu, ncollectors=%d", filename, bs, nc );
...@@ -112,10 +110,7 @@ static bFiledataP * initBFiledataP ( char *filename, ...@@ -112,10 +110,7 @@ static bFiledataP * initBFiledataP ( char *filename,
bfp->size = bs; bfp->size = bs;
if (( bfp->fp = fopen ( filename, "w" )) == NULL ) if (( bfp->fp = fopen ( filename, "w" )) == NULL )
{ xabort("Failed to open %s", bfp->name);
sprintf ( errorString, "Failed to open %s", bfp->name );
xabort ( errorString );
}
dbuffer_init ( & ( bfp->fb ), ( size_t )( bfp->size )); dbuffer_init ( & ( bfp->fb ), ( size_t )( bfp->size ));
...@@ -222,16 +217,12 @@ static void ...@@ -222,16 +217,12 @@ static void
writeP(bFiledataP *bfd, long amount) writeP(bFiledataP *bfd, long amount)
{ {
long written; long written;
char errorString[maxErrorString];
xdebug ( "filename=%s, amount=%ld, in", bfd->name, amount ); xdebug ( "filename=%s, amount=%ld, in", bfd->name, amount );
if (( written = fwrite ( bfd->fb->buffer, sizeof ( char ), amount, if (( written = fwrite ( bfd->fb->buffer, sizeof ( char ), amount,
bfd->fp )) != amount ) bfd->fp )) != amount )
{ xabort("did not succeed writing buffer in %s", bfd->name);
sprintf ( errorString, "did not succeed writing buffer in %s", bfd->name );
xabort ( errorString );
}
xdebug ( "filename=%s, written=%ld, amount=%ld, return", xdebug ( "filename=%s, written=%ld, amount=%ld, return",
bfd->name, written, amount ); bfd->name, written, amount );
...@@ -245,8 +236,7 @@ void queueCheckP ( queue_t *q, char *name ) ...@@ -245,8 +236,7 @@ void queueCheckP ( queue_t *q, char *name )
listElem_t *curr; listElem_t *curr;
bFiledataP *bfd; bFiledataP *bfd;
size_t len; size_t len;
char errorString[maxErrorString];
len = strlen ( name ); len = strlen ( name );
curr = q->head; curr = q->head;
...@@ -255,12 +245,8 @@ void queueCheckP ( queue_t *q, char *name ) ...@@ -255,12 +245,8 @@ void queueCheckP ( queue_t *q, char *name )
bfd = ( bFiledataP * ) curr->val; bfd = ( bFiledataP * ) curr->val;
if ( len == strlen ( bfd->name ) && if ( len == strlen ( bfd->name ) &&
memcmp ( name, bfd->name, len ) == 0 ) memcmp ( name, bfd->name, len ) == 0 )
{ xabort("Filename %s is already enqueued\n", name);
sprintf ( errorString, "Filename %s is already enqueued\n", name );
xabort ( errorString );
return;
}
curr = curr->next; curr = curr->next;
} }
} }
...@@ -604,7 +590,6 @@ int fowPOSIXNONB ( const char *filename ) ...@@ -604,7 +590,6 @@ int fowPOSIXNONB ( const char *filename )
char message[messageLength]; char message[messageLength];
size_t l; size_t l;
char *temp; char *temp;
char errorString[maxErrorString];
/* broadcast buffersize to collectors */ /* broadcast buffersize to collectors */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment