IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 22, 2006, 1:45:34 PM (20 years ago)
Author:
jhoblitt
Message:

allow any length psTrace strings by calculating the formatted strings length with vsnprintf -- this may or may not be a performance issue.

File:
1 edited

Legend:

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

    r8473 r8476  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-22 21:53:49 $
     11 *  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-22 23:45:34 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    592592
    593593        if (traceMsg) {
    594             char line[MAX_TRACE_LENGTH + 1];
     594            // calculate the length of the formatted string
     595            // XXX this may or may not be a performance issue
     596            #if 1
     597            ssize_t traceLength = vsnprintf(NULL, 0, format, ap);
     598            #else
     599
     600            ssize_t traceLength = MAX_TRACE_LENGTH;
     601            #endif
     602
     603            char line[traceLength + 1];
    595604
    596605            // We indent each message one space for each level of the message.
     
    598607                write (traceFD, " ", 1);
    599608            }
    600             vsnprintf(line, MAX_TRACE_LENGTH, format, ap);
     609            vsnprintf(line, traceLength, format, ap);
    601610            write (traceFD, line, strlen(line));
    602611            if (line[strlen(line) - 1] != '\n') {
Note: See TracChangeset for help on using the changeset viewer.