Remove libbsd and strlcpy

This commit is contained in:
Tobias Reisinger 2020-11-19 23:36:02 +01:00
parent 3f11431df6
commit 1f315d2b92
15 changed files with 53 additions and 50 deletions
src/models

View file

@ -1,4 +1,3 @@
#include <bsd/string.h>
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>
@ -53,14 +52,16 @@ controller_db_select_mapper(sqlite3_stmt *stmt)
new_controller->id = sqlite3_column_int(stmt, i);
break;
case 'p': // ip
strlcpy(new_controller->ip, (const char*)sqlite3_column_text(stmt, i), sizeof(new_controller->ip));
strncpy(new_controller->ip, (const char*)sqlite3_column_text(stmt, i), IP_LENGTH);
new_controller->ip[IP_LENGTH] = '\0';
break;
default: // ignore columns not implemented
break;
}
break;
case 'n': // name
strlcpy(new_controller->name, (const char*)sqlite3_column_text(stmt, i), sizeof(new_controller->name));
strncpy(new_controller->name, (const char*)sqlite3_column_text(stmt, i), MAX_NAME_LENGTH);
new_controller->name[MAX_NAME_LENGTH] = '\0';
break;
case 'p': // port
new_controller->port = sqlite3_column_int(stmt, i);