1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 12:32:21 +00:00
2018-12-16 12:36:29 +08:00

27 lines
422 B
C

// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include "mystring.h"
#include <string.h>
static char buffer[1024];
static char* malloc(int size) {
return &buffer[0];
}
static void free(void* p) {
//
}
char* make_string(const char* s) {
char* p = malloc(strlen(s)+1);
strcpy(p, s);
return p;
}
void free_string(char* s) {
free(s);
}