Changeset 1064 in MondoRescue for branches/stable/mondo/src/lib


Ignore:
Timestamp:
Jan 23, 2007, 1:09:32 AM (17 years ago)
Author:
Bruno Cornec
Message:

More controls at the compiler level
still working with the problems around variable arguments

Location:
branches/stable/mondo/src/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/lib/mr_conf.c

    r1054 r1064  
    6868static size_t mr_conf_filesize(const char *name);
    6969static void mr_conf_error_msg(int error_code, const char *add_line);
    70 static void mr_conf_remove_comments();
     70static void mr_conf_remove_comments(void);
    7171static int mr_conf_check_int_flag(const int flag);
    7272static void mr_conf_set_int_flag(const int flag);
     
    141141
    142142/*release all memory and prepare to the next possiable config file*/
    143 void mr_conf_close() {
     143void mr_conf_close(void) {
    144144    /* if not opened => error */
    145145    if (!mr_conf_check_int_flag(MRCONF_INTFLAG_OPEN)) {
  • branches/stable/mondo/src/lib/mr_err.c

    r1061 r1064  
    99 * Provided under the GPLv2
    1010 */
     11
     12#ifndef _GNU_SOURCE
     13#define _GNU_SOURCE
     14#endif
    1115
    1216#include <stdio.h>
  • branches/stable/mondo/src/lib/mr_mem.c

    r1061 r1064  
    99 * Provided under the GPLv2
    1010 */
     11
     12#ifndef _GNU_SOURCE
     13#define _GNU_SOURCE
     14#endif
    1115
    1216#include <stdio.h>
     
    5256
    5357/* encapsulation function for asprintf */
    54 void mr_asprintf(char **strp, const char *fmt, va_list args) {
     58void mr_asprintf(char **strp, const char *fmt, ...) {
    5559
    5660    int res = 0;
     61    va_list args;
    5762
     63    va_start(args,fmt);
    5864    res = vasprintf(strp, fmt, args);
    5965    if (res == -1) {
    6066        mr_log_exit(-1,"Unable to alloc memory in mr_asprintf\nExiting...");
    6167    }
     68    va_end(args);
    6269}
    6370
  • branches/stable/mondo/src/lib/mr_msg.c

    r1061 r1064  
    1010 */
    1111
     12#ifndef _GNU_SOURCE
     13#define _GNU_SOURCE
     14#endif
    1215#include <stdio.h>
    1316#include <stdarg.h>
     17#include <stdlib.h>
    1418
    1519static int mr_loglevel = 0;
     
    4347 * but through other functions
    4448 */
    45 void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, va_list args) {
     49void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, ...) {
    4650
    4751    int i = 0;
    4852    int res = 0;
    4953    FILE *fout = NULL;
     54    va_list args;
    5055
    5156    if (mr_logfile == NULL) {
     
    5863            return;
    5964        }
     65        va_start(args,fmt);
    6066
    6167        // add 2 spaces to distinguish log levels
     
    6773        if (vfprintf(fout, fmt, args) < 0) {
    6874            fprintf(stderr,"Unable to print to %s\n",mr_logfile);
    69             return;
    7075        }
    7176
     
    7479            fprintf(stderr,"Unable to close %s\n",mr_logfile);
    7580        }
     81        va_end(args);
    7682    }
    7783}
    7884
    79 void mr_msg(int level, const char *fmt, va_list args) {
     85void mr_msg(int level, const char *fmt, ...) {
    8086
     87    va_list args;
     88
     89    va_start(args,fmt);
    8190    _mr_msg(level, __FILE__, __FUNCTION__, __LINE__, fmt, args);
     91    va_end(args);
    8292}
Note: See TracChangeset for help on using the changeset viewer.