Ignore:
Timestamp:
May 14, 2014 9:00:35 AM (7 years ago)
Author:
kulshres
Message:

get rid of strdup, it is in POSIX but not in ISO standard

so we can compile using -std=c99 and -std=c++11

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/src/taping.c

    r502 r507  
    432432/* Tries to read a local config file containing, e.g., buffer sizes         */
    433433/****************************************************************************/
     434static char* duplicatestr(const char* instr) {
     435    size_t len = strlen(instr);
     436    char *outstr = calloc(len+1,sizeof(char));
     437    strncpy(outstr,instr,len);
     438    return outstr;
     439}
     440
    434441#define ADOLC_LINE_LENGTH 100
    435442void readConfigFile() {
     
    441448    char *path = NULL;
    442449    int defdirsize = strlen(TAPE_DIR PATHSEPARATOR);
    443     tapeBaseNames[0] = strdup(
     450    tapeBaseNames[0] = duplicatestr(
    444451        TAPE_DIR PATHSEPARATOR ADOLC_LOCATIONS_NAME);
    445     tapeBaseNames[1] = strdup(
     452    tapeBaseNames[1] = duplicatestr(
    446453        TAPE_DIR PATHSEPARATOR ADOLC_VALUES_NAME);
    447     tapeBaseNames[2] = strdup(
     454    tapeBaseNames[2] = duplicatestr(
    448455        TAPE_DIR PATHSEPARATOR ADOLC_OPERATIONS_NAME);
    449     tapeBaseNames[3] = strdup(
     456    tapeBaseNames[3] = duplicatestr(
    450457        TAPE_DIR PATHSEPARATOR ADOLC_TAYLORS_NAME);
    451458
Note: See TracChangeset for help on using the changeset viewer.