From b28c702275d091b87bdae85c15b347827918858b Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sat, 13 Jun 2015 00:15:39 +0200 Subject: [PATCH] fix some C compiler warnings --- psutil/arch/bsd/freebsd.c | 13 ++++++------- psutil/arch/bsd/freebsd.h | 2 +- psutil/arch/bsd/freebsd_socks.c | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/psutil/arch/bsd/freebsd.c b/psutil/arch/bsd/freebsd.c index 35b908954..4000c2c21 100644 --- a/psutil/arch/bsd/freebsd.c +++ b/psutil/arch/bsd/freebsd.c @@ -25,8 +25,8 @@ #include // process open files, shared libs (kinfo_getvmmap), cwd #include - #include "freebsd.h" +#include "../../_psutil_common.h" #define TV2DOUBLE(t) ((t).tv_sec + (t).tv_usec / 1000000.0) @@ -67,7 +67,7 @@ psutil_kinfo_proc(const pid_t pid, struct kinfo_proc *proc) { } -void +int psutil_raise_ad_or_nsp(long pid) { // Set exception to AccessDenied if pid exists else NoSuchProcess. int ret; @@ -76,19 +76,18 @@ psutil_raise_ad_or_nsp(long pid) { NoSuchProcess(); else if (ret == 1) AccessDenied(); - else - return NULL; + return ret; } // remove spaces from string -void psutil_remove_spaces(char *str) { +static void psutil_remove_spaces(char *str) { char *p1 = str; char *p2 = str; do while (*p2 == ' ') p2++; - while (*p1++ = *p2++); + while ((*p1++ = *p2++)); } @@ -194,7 +193,7 @@ psutil_get_proc_list(struct kinfo_proc **procList, size_t *procCount) { * -1 for failure (Exception raised); * 1 for insufficient privileges. */ -char +static char *psutil_get_cmd_args(long pid, size_t *argsize) { int mib[4], argmax; size_t size = sizeof(argmax); diff --git a/psutil/arch/bsd/freebsd.h b/psutil/arch/bsd/freebsd.h index c49f42ea2..e50c5b1fd 100644 --- a/psutil/arch/bsd/freebsd.h +++ b/psutil/arch/bsd/freebsd.h @@ -8,7 +8,7 @@ typedef struct kinfo_proc kinfo_proc; -char *psutil_get_cmd_args(long pid, size_t *argsize); +static char *psutil_get_cmd_args(long pid, size_t *argsize); int psutil_get_proc_list(struct kinfo_proc **procList, size_t *procCount); int psutil_kinfo_proc(const pid_t pid, struct kinfo_proc *proc); int psutil_pid_exists(long pid); diff --git a/psutil/arch/bsd/freebsd_socks.c b/psutil/arch/bsd/freebsd_socks.c index 77a56d44d..1539541e9 100644 --- a/psutil/arch/bsd/freebsd_socks.c +++ b/psutil/arch/bsd/freebsd_socks.c @@ -23,6 +23,7 @@ #include #include +#include "freebsd.h" #include "freebsd_socks.h"