]> pd.if.org Git - zpackage/commitdiff
use posix strdup in findpkg
authorNathan Wagner <nw@hydaspes.if.org>
Sat, 15 Sep 2018 08:48:09 +0000 (08:48 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 17 Sep 2018 12:13:04 +0000 (12:13 +0000)
lib/findpkg.c

index a8d8ff49f791b7010be411f537a2e171b26f8380..732f1bb193d3762494886030afa425242c7a494d 100644 (file)
@@ -1,3 +1,5 @@
+#define _POSIX_C_SOURCE 200809L
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -81,7 +83,7 @@ struct zpm_package *zpm_package_alloc(struct zpm *zpm) {
 void zpm_sqlite_error(struct zpm *zpm) {
        zpm->error = 1;
        if (zpm->errmsg) free(zpm->errmsg);
-       zpm->errmsg = zpm_strdup((char *)sqlite3_errmsg(zpm->db));
+       zpm->errmsg = strdup(sqlite3_errmsg(zpm->db));
 }
 
 char *zpm_findpkg(struct zpm *zpm, char *pkgstr) {
@@ -149,7 +151,7 @@ char *zpm_findpkg(struct zpm *zpm, char *pkgstr) {
 
        switch (sqlite3_step(stmt)) {
                case SQLITE_ROW:
-                       zpm->pkgid = zpm_strdup((char *)sqlite3_column_text(stmt, 0));
+                       zpm->pkgid = strdup(sqlite3_column_text(stmt, 0));
                        break;
                case SQLITE_DONE:
                        /* not found */