Subversion Repositories MLServ

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

/* $Id: string.c 1 2024-09-07 01:58:02Z nishi $ */

#include "cm_string.h"

#include <string.h>
#include <stdlib.h>

char* cm_strcat(const char* a, const char* b){
        char* str = malloc(strlen(a) + strlen(b) + 1);
        memcpy(str, a, strlen(a));
        memcpy(str + strlen(a), b, strlen(b));
        str[strlen(a) + strlen(b)] = 0;
        return str;
}

char* cm_strdup(const char* str){
        return cm_strcat(str, "");
}