Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kaworu/5204112 to your computer and use it in GitHub Desktop.
Save kaworu/5204112 to your computer and use it in GitHub Desktop.
pkgng patches to build with gcc48
From 84f23ecf8d1410216336257c16a374b9d420be44 Mon Sep 17 00:00:00 2001
From: Alexandre Perrin <[email protected]>
Date: Fri, 8 Mar 2013 17:25:22 +0100
Subject: [PATCH] Fix build with gcc48: free_func is never NULL.
---
libpkg/private/pkg.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libpkg/private/pkg.h b/libpkg/private/pkg.h
index f6ad119..a92fdcf 100644
--- a/libpkg/private/pkg.h
+++ b/libpkg/private/pkg.h
@@ -70,8 +70,7 @@
struct type *hf1, *hf2; \
HASH_ITER(hh, data, hf1, hf2) { \
HASH_DEL(data, hf1); \
- if (free_func != NULL) \
- free_func(hf1); \
+ free_func(hf1); \
} \
data = NULL; \
} while (0)
@@ -80,8 +79,7 @@
struct type *l1, *l2; \
LL_FOREACH_SAFE(head, l1, l2) { \
LL_DELETE(head, l1); \
- if (free_func != NULL) \
- free_func(l1); \
+ free_func(l1); \
} \
head = NULL; \
} while (0)
--
1.8.1.3
From daf770520bc1356523ab3c4c0ba5f5c0c4b7026a Mon Sep 17 00:00:00 2001
From: Alexandre Perrin <[email protected]>
Date: Fri, 8 Mar 2013 17:26:24 +0100
Subject: [PATCH] Fix build with gcc48: use the previously unused `ret'
variable.
---
libpkg/pkg_ports.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libpkg/pkg_ports.c b/libpkg/pkg_ports.c
index afc4a00..e856c03 100644
--- a/libpkg/pkg_ports.c
+++ b/libpkg/pkg_ports.c
@@ -340,7 +340,7 @@ file(struct plist *p, char *line, struct file_attr *a)
cleanup:
free_file_attr(a);
- return (EPKG_OK);
+ return (ret);
}
static int
--
1.8.1.3
From 51a90c1467c1014d6e636467f2bc6eeb5acedeb0 Mon Sep 17 00:00:00 2001
From: Alexandre Perrin <[email protected]>
Date: Fri, 8 Mar 2013 17:24:45 +0100
Subject: [PATCH] Fix gcc48 build: Remove unused variables and cli options.
---
pkg/fetch.c | 12 +++---------
pkg/install.c | 6 +-----
pkg/plugins.c | 4 ----
pkg/upgrade.c | 6 +-----
4 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/pkg/fetch.c b/pkg/fetch.c
index becbbd1..6da800d 100644
--- a/pkg/fetch.c
+++ b/pkg/fetch.c
@@ -43,9 +43,9 @@
void
usage_fetch(void)
{
- fprintf(stderr, "usage: pkg fetch [-r reponame] [-dgiLqxy] <pkg-name> <...>\n");
- fprintf(stderr, " pkg fetch [-r reponame] [-dLqy] -a\n");
- fprintf(stderr, " pkg fetch [-r reponame] [-dLqy] -u\n\n");
+ fprintf(stderr, "usage: pkg fetch [-dgiLqxy] <pkg-name> <...>\n");
+ fprintf(stderr, " pkg fetch [-dLqy] -a\n");
+ fprintf(stderr, " pkg fetch [-dLqy] -u\n\n");
fprintf(stderr, "For more information see 'pkg help fetch'.\n");
}
@@ -54,11 +54,9 @@ exec_fetch(int argc, char **argv)
{
struct pkgdb *db = NULL;
struct pkg_jobs *jobs = NULL;
- const char *reponame = NULL;
int ch;
int retcode = EX_SOFTWARE;
bool auto_update;
- bool force = false;
bool upgrades_for_installed = false;
bool yes;
unsigned mode;
@@ -75,7 +73,6 @@ exec_fetch(int argc, char **argv)
break;
case 'd':
f |= PKG_FLAG_WITH_DEPS;
- force = true;
break;
case 'g':
match = MATCH_GLOB;
@@ -89,9 +86,6 @@ exec_fetch(int argc, char **argv)
case 'q':
quiet = true;
break;
- case 'r':
- reponame = optarg;
- break;
case 'u':
f |= PKG_FLAG_UPGRADES_FOR_INSTALLED;
upgrades_for_installed = true;
diff --git a/pkg/install.c b/pkg/install.c
index a64b670..ee9b940 100644
--- a/pkg/install.c
+++ b/pkg/install.c
@@ -46,7 +46,7 @@ void
usage_install(void)
{
fprintf(stderr,
- "usage: pkg install [-AfgIiLnqRxy] [-r reponame] <pkg-name> ...\n\n");
+ "usage: pkg install [-AfgIiLnqRxy] <pkg-name> ...\n\n");
fprintf(stderr, "For more information see 'pkg help install'.\n");
}
@@ -55,7 +55,6 @@ exec_install(int argc, char **argv)
{
struct pkgdb *db = NULL;
struct pkg_jobs *jobs = NULL;
- const char *reponame = NULL;
int retcode;
int updcode = EPKG_OK;
int ch;
@@ -100,9 +99,6 @@ exec_install(int argc, char **argv)
case 'R':
f |= PKG_FLAG_RECURSIVE;
break;
- case 'r':
- reponame = optarg;
- break;
case 'x':
match = MATCH_REGEX;
break;
diff --git a/pkg/plugins.c b/pkg/plugins.c
index 3673093..b32dc02 100644
--- a/pkg/plugins.c
+++ b/pkg/plugins.c
@@ -45,13 +45,9 @@ exec_plugins(int argc, char **argv)
{
struct pkg_plugin *p = NULL;
int ch;
- bool list_only = true;
while ((ch = getopt(argc, argv, "l")) != -1) {
switch (ch) {
- case 'l':
- list_only = true;
- break;
default:
usage_plugins();
return (EX_USAGE);
diff --git a/pkg/upgrade.c b/pkg/upgrade.c
index d960bc2..29943f8 100644
--- a/pkg/upgrade.c
+++ b/pkg/upgrade.c
@@ -38,7 +38,7 @@
void
usage_upgrade(void)
{
- fprintf(stderr, "usage: pkg upgrade [-fILnqy] [-r reponame]\n\n");
+ fprintf(stderr, "usage: pkg upgrade [-fILnqy]\n\n");
fprintf(stderr, "For more information see 'pkg help upgrade'.\n");
}
@@ -47,7 +47,6 @@ exec_upgrade(int argc, char **argv)
{
struct pkgdb *db = NULL;
struct pkg_jobs *jobs = NULL;
- const char *reponame = NULL;
int retcode;
int updcode;
int ch;
@@ -79,9 +78,6 @@ exec_upgrade(int argc, char **argv)
case 'q':
quiet = true;
break;
- case 'r':
- reponame = optarg;
- break;
case 'y':
yes = true;
break;
--
1.8.1.3
diff --git a/libpkg/pkg_ports.c b/libpkg/pkg_ports.c
index f27de60..6345ec4 100644
--- a/libpkg/pkg_ports.c
+++ b/libpkg/pkg_ports.c
@@ -214,7 +214,7 @@ meta_dirrm(struct plist *p, char *line, struct file_attr *a, bool try)
char *testpath;
struct stat st;
bool developer;
- int ret;
+ int ret = EPKG_OK;
len = strlen(line);
@@ -283,7 +283,7 @@ file(struct plist *p, char *line, struct file_attr *a)
bool regular = false;
bool developer;
char sha256[SHA256_DIGEST_LENGTH * 2 + 1];
- int ret;
+ int ret = EPKG_OK;
len = strlen(line);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment