Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dupstr.c « utils - github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fd79583f04132da8413c34c9cb8afb51fd9ac25b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * Allocate a duplicate of an ordinary C NUL-terminated string.
 */

#include <string.h>

#include "defs.h"
#include "misc.h"

char *dupstr(const char *s)
{
    char *p = NULL;
    if (s) {
        int len = strlen(s);
        p = snewn(len + 1, char);
        strcpy(p, s);
    }
    return p;
}