IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8600


Ignore:
Timestamp:
Aug 25, 2006, 12:00:54 PM (20 years ago)
Author:
Paul Price
Message:

Discovered real cause of SEGVs on AMD64: see bug 809. Restoring use
of variable length arrays (want flexibility as to length). Using new
function, psStringAppendV, to generate the output string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psTrace.c

    r8577 r8600  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.76 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-25 00:03:35 $
     11 *  @version $Revision: 1.77 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-25 22:00:54 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    593593
    594594        if (traceMsg) {
    595             // calculate the length of the formatted string
    596             // XXX this may or may not be a performance issue
    597             char line[MAX_TRACE_LENGTH];
    598 
    599595            // We indent each message one space for each level of the message.
    600596            for (int i = 0; i < level; i++) {
    601597                write (traceFD, " ", 1);
    602598            }
    603             vsnprintf(&line[0], MAX_TRACE_LENGTH, format, ap);
     599            psString line = NULL;       // Line to print
     600            psStringAppendV(&line, format, ap);
    604601            write (traceFD, line, strlen(line));
    605602            if (line[strlen(line) - 1] != '\n') {
     
    647644    // Append the function name to the facility
    648645    size_t facilLength = strlen(facil); // Length of facility name
    649     char fullFacil[MAX_HEADER_LENGTH]; // Full facility name is the facility + the function name
    650     strncpy(&fullFacil[0], facil, MAX_HEADER_LENGTH);
    651     if (facilLength + 1 < MAX_HEADER_LENGTH) {
    652         fullFacil[facilLength] = '.';
    653         strncpy(&fullFacil[facilLength + 1], func, MAX_HEADER_LENGTH - facilLength - 1);
    654     }
     646    size_t funcLength = strlen(func);   // Length of function name
     647    char fullFacil[facilLength + funcLength + 2]; // Full facility name is the facility + the function name
     648    strcpy(&fullFacil[0], facil);
     649    fullFacil[facilLength] = '.';
     650    strcpy(&fullFacil[facilLength + 1], func);
    655651
    656652    va_list ap;
Note: See TracChangeset for help on using the changeset viewer.