PERFORCE change 129787 for review
Garrett Cooper
gcooper at FreeBSD.org
Thu Nov 29 11:40:29 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=129787
Change 129787 by gcooper at shiina-ibook on 2007/11/29 19:39:33
Style.
Affected files ...
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_freebsd_contents.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_manifest_freebsd.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_files.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_ftp.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_local_freebsd.c#2 edit
Differences ...
==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_freebsd_contents.c#2 (text+ko) ====
@@ -171,35 +171,48 @@
}
/* Get the correct line type for the line */
- if (!strcmp(cont->lines[pos].line, "@comment")) {
+ if (strcmp(cont->lines[pos].line, "@comment") == 0) {
cont->lines[pos].line_type = PKG_LINE_COMMENT;
- } else if (!strcmp(cont->lines[pos].line, "@name")) {
+ } else if (strcmp(cont->lines[pos].line, "@name") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_NAME;
- } else if (!strcmp(cont->lines[pos].line, "@cwd")) {
+ } else if (strcmp(cont->lines[pos].line, "@cwd") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_CWD;
- } else if (!strcmp(cont->lines[pos].line, "@pkgdep")) {
+ } else if (strcmp(cont->lines[pos].line, "@pkgdep") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_PKGDEP;
- } else if (!strcmp(cont->lines[pos].line, "@conflicts"))
- {
+ } else if (
+ strcmp(cont->lines[pos].line, "@conflicts") == 0
+ ) {
cont->lines[pos].line_type = PKG_LINE_CONFLICTS;
- } else if (!strcmp(cont->lines[pos].line, "@exec")) {
+ } else if (strcmp(cont->lines[pos].line, "@exec") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_EXEC;
- } else if (!strcmp(cont->lines[pos].line, "@unexec")) {
+ } else if (strcmp(cont->lines[pos].line, "@unexec") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_UNEXEC;
- } else if (!strcmp(cont->lines[pos].line, "@dirrm")) {
+ } else if (strcmp(cont->lines[pos].line, "@dirrm") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_DIRRM;
- } else if (!strcmp(cont->lines[pos].line, "@mtree")) {
+ } else if (strcmp(cont->lines[pos].line, "@mtree") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_MTREE;
- } else if (!strcmp(cont->lines[pos].line, "@display")) {
+ } else if (strcmp(cont->lines[pos].line, "@display") ==
+ 0) {
cont->lines[pos].line_type = PKG_LINE_DISPLAY;
} else {
cont->lines[pos].line_type = PKG_LINE_UNKNOWN;
fprintf(stderr, "Unknown line type %s\n",
cont->lines[pos].line);
}
+
}
+
}
+
return cont;
+
}
/**
@@ -209,7 +222,7 @@
pkg_freebsd_contents_add_line(struct pkg_freebsd_contents *contents, int type,
const char *data)
{
- if (!contents || !data)
+ if (contents == NULL || data == NULL)
return -1;
if (!(type > 0 && type <= PKG_LINE_FILE)) {
@@ -307,7 +320,7 @@
}
data = pkgfile_get_data(file);
- if (!data)
+ if (data == NULL)
return -1;
MD5Data(data, pkgfile_get_size(file), md5);
snprintf(tmp, 37, "MD5:%s", md5);
@@ -406,14 +419,13 @@
int
pkg_freebsd_contents_free(struct pkg_freebsd_contents *contents)
{
- if (!contents) {
+ if (contents == NULL)
return -1;
- }
- if (contents->file)
+ if (contents->file != NULL)
free(contents->file);
- if (contents->lines)
+ if (contents->lines != NULL)
free(contents->lines);
free(contents);
==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_manifest_freebsd.c#2 (text+ko) ====
@@ -108,7 +108,7 @@
manifest->attrs[pkgm_prefix]);
}
- /* Add the package's dependency's */
+ /* Add the package's dependencies */
STAILQ_FOREACH(dep, &manifest->deps, list) {
pkgfile_append_string(manifest->file, "@pkgdep %s\n",
pkg_get_name(dep->pkg));
==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo.c#2 (text+ko) ====
@@ -50,9 +50,8 @@
struct pkg_repo *repo;
repo = malloc(sizeof(struct pkg_repo));
- if (!repo) {
+ if (repo == NULL)
return NULL;
- }
repo->pkg_get = pkg_get;
repo->pkg_free = pkg_free;
@@ -80,13 +79,13 @@
pkg_repo_get_pkg(struct pkg_repo *repo, const char *pkg_name)
{
if (repo == NULL)
- return NULL;
+ return NULL;
if (pkg_name == NULL)
- return NULL;
+ return NULL;
if (repo->pkg_get == NULL)
- return NULL;
+ return NULL;
return repo->pkg_get(repo, pkg_name);
}
@@ -98,11 +97,11 @@
int
pkg_repo_free(struct pkg_repo *repo)
{
- if (!repo)
- return -1;
+ if (repo == NULL)
+ return -1;
- if (repo->pkg_free)
- repo->pkg_free(repo);
+ if (repo->pkg_free != NULL)
+ repo->pkg_free(repo);
free(repo);
@@ -111,4 +110,4 @@
/**
* @}
- */+ */
==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_files.c#2 (text+ko) ====
@@ -68,7 +68,7 @@
/**
* @brief Callback for pkg_repo_get_pkg()
- * @param repo The repo creates with pkg_repo_new_files()
+ * @param repo The repo created with pkg_repo_new_files(..)
* @param pkg_name The file to create a package from
* @return A pkg object or NULL
*/
@@ -83,14 +83,13 @@
/* Open the package file */
fd = fopen(pkg_name, "r");
- if (!fd) {
+ if (fd == NULL)
return NULL;
- }
/* Create the package */
/* XXX auto detect package type */
pkg = pkg_new_freebsd_from_file(fd);
- if (!pkg) {
+ if (pkg == NULL) {
fclose(fd);
return NULL;
}
==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_ftp.c#2 (text+ko) ====
@@ -119,11 +119,11 @@
struct pkg_repo *repo;
repo = pkg_repo_new(ftp_get_pkg, ftp_free);
- if (!repo)
+ if (repo == NULL)
return NULL;
repo->data = ftp_create_repo(site, path, cache_dir);
- if (!repo->data) {
+ if (repo->data == NULL) {
ftp_free(repo);
return NULL;
}
@@ -172,7 +172,7 @@
fd = pkg_cached_file(fd2, cache_file);
}
pkg = pkg_new_freebsd_from_file(fd);
- if (!pkg) {
+ if (pkg == NULL) {
fclose(fd);
return NULL;
}
@@ -194,7 +194,7 @@
f_repo = repo->data;
/* If there is no repo we don't need to free it */
- if (!f_repo)
+ if (f_repo == NULL)
return 0;
if (f_repo->site)
@@ -251,9 +251,8 @@
asprintf(&ftpname, "%s/%s/%s/%s%s", f_repo->site, f_repo->path,
subdir, pkg_name, ext);
- if (!ftpname) {
+ if (ftpname == NULL)
return NULL;
- }
fd = fetchGetURL(ftpname, "p");
@@ -262,7 +261,7 @@
free(ftpname);
asprintf(&ftpname, "%s/%s/%s/%s%s", f_repo->site,
f_repo->path, fallback_subdir, pkg_name, ext);
- if (!ftpname) {
+ if (ftpname == NULL) {
return NULL;
}
fd = fetchGetURL(ftpname, "p");
@@ -288,23 +287,21 @@
struct ftp_repo *f_repo;
f_repo = malloc(sizeof(struct ftp_repo));
- if (!f_repo) {
+ if (f_repo == NULL)
return NULL;
- }
/* Figure out the site */
- if (!site)
+ if (site == NULL)
f_repo->site = strdup("ftp://ftp.freebsd.org");
else
f_repo->site = strdup(site);
- if (!f_repo->site) {
+ if (f_repo->site == NULL)
return NULL;
- }
/* Figure out the path */
f_repo->path = NULL;
- if (!path) {
+ if (path == NULL) {
struct utsname u;
int i, reldate;
@@ -337,9 +334,8 @@
f_repo->path = strdup(path);
}
- if (!f_repo->path) {
+ if (f_repo->path == NULL)
return NULL;
- }
f_repo->cache = 0;
if (cache_dir != NULL) {
==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/contrib/libpkg/pkg_repo_local_freebsd.c#2 (text+ko) ====
@@ -88,24 +88,24 @@
/* XXX Check the file is a package file after every attempt to open it */
snprintf(dir, MAXPATHLEN + 1,"%s.tbz", pkg_name);
fd = fopen(dir, "r");
- if (!fd) {
+ if (fd == NULL) {
snprintf(dir, MAXPATHLEN + 1,
"/usr/ports/packages/All/%s.tbz", pkg_name);
fd = fopen(dir, "r");
}
- if (!fd) {
+ if (fd == NULL) {
fd = fopen(pkg_name, "r");
}
- if (!fd) {
+ if (fd == NULL) {
snprintf(dir, MAXPATHLEN + 1,
"/usr/ports/packages/All/%s", pkg_name);
fd = fopen(dir, "r");
}
- if (!fd)
+ if (fd == NULL)
return NULL;
pkg = pkg_new_freebsd_from_file(fd);
- if (!pkg) {
+ if (pkg == NULL) {
fclose(fd);
return NULL;
}
More information about the p4-projects
mailing list