/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/error.c

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-02 22:36:19 UTC
  • mfrom: (346.1.35 pcitool)
  • Revision ID: csa@suren.me-20160302223619-r1zd62x6kwbyd321
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#define PCILIB_LOGGER_HISTORY 16
13
13
 
14
14
void pcilib_print_error(void *arg, const char *file, int line, pcilib_log_priority_t prio, const char *msg, va_list va) {
15
 
    vprintf(msg, va);
16
 
    printf(" [%s:%d]\n", file, line);
 
15
    size_t size = strlen(msg) + strlen(file) + 64;
 
16
    char *stmp = alloca(size * sizeof(char*));
 
17
 
 
18
    if (stmp) {
 
19
        sprintf(stmp, "%s [%s:%d]\n", msg, file, line);
 
20
        vprintf(stmp, va);
 
21
    } else {
 
22
            // Bad for multithreading...
 
23
        vprintf(msg, va);
 
24
        printf(" [%s:%d]\n", file, line);
 
25
    }
17
26
}
18
27
 
19
28
static void *pcilib_logger_argument = NULL;