Changeset 138940 for trunk/base


Ignore:
Timestamp:
Jul 24, 2015, 11:06:48 AM (5 years ago)
Author:
raimue@…
Message:

pextlib: Remove fixed buffer size by using vasprintf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/pextlib1.0/Pextlib.c

    r138939 r138940  
    108108__printflike(3, 0)
    109109static void ui_message(Tcl_Interp *interp, const char *severity, const char *format, va_list va) {
    110     char buf[1024], tclcmd[32];
    111 
    112     vsnprintf(buf, sizeof(buf), format, va);
     110    char tclcmd[32];
     111    char *buf;
     112
     113    if (vasprintf(&buf, format, va) < 0) {
     114        perror("vasprintf");
     115        return;
     116    }
    113117
    114118    snprintf(tclcmd, sizeof(tclcmd), "ui_%s $warn", severity);
     
    119123    }
    120124    Tcl_UnsetVar(interp, "warn", 0);
     125    free(buf);
    121126}
    122127
Note: See TracChangeset for help on using the changeset viewer.