/* * Stairs * Copyright 2017 (c) Mark van Renswoude * * https://git.x2software.net/pub/Stairs */ #include "./charproperties.h" #include #include #include "./debug.h" void assignChar(char** field, const char* newValue) { if (*field != nullptr) delete *field; if (newValue != nullptr) { // Include the terminating null character size_t length = strlen(newValue) + 1; if (length > 0) { *field = new char[length]; strncpy(*field, newValue, length); } else *field = nullptr; } else *field = nullptr; }