Merge pull request #6 from richq/static-checks

Static checks
This commit is contained in:
Tatsuya Kinoshita committed 2015-08-06 23:09:58 +09:00
commit 7834d34636
5 files changed
+23 -21

No files matched your search

+8 -8
View File
@@ -56,7 +56,7 @@ Strnew_size(int n)
} }
Str Str
Strnew_charp(char *p) Strnew_charp(const char *p)
{ {
Str x; Str x;
int n; int n;
@@ -73,7 +73,7 @@ Strnew_charp(char *p)
} }
Str Str
Strnew_m_charp(char *p, ...) Strnew_m_charp(const char *p, ...)
{ {
va_list ap; va_list ap;
Str r = Strnew(); Str r = Strnew();
@@ -87,7 +87,7 @@ Strnew_m_charp(char *p, ...)
} }
Str Str
Strnew_charp_n(char *p, int n) Strnew_charp_n(const char *p, int n)
{ {
Str x; Str x;
@@ -140,7 +140,7 @@ Strcopy(Str x, Str y)
} }
void void
Strcopy_charp(Str x, char *y) Strcopy_charp(Str x, const char *y)
{ {
int len; int len;
@@ -160,7 +160,7 @@ Strcopy_charp(Str x, char *y)
} }
void void
Strcopy_charp_n(Str x, char *y, int n) Strcopy_charp_n(Str x, const char *y, int n)
{ {
int len = n; int len = n;
@@ -180,7 +180,7 @@ Strcopy_charp_n(Str x, char *y, int n)
} }
void void
Strcat_charp_n(Str x, char *y, int n) Strcat_charp_n(Str x, const char *y, int n)
{ {
int newlen; int newlen;
@@ -209,7 +209,7 @@ Strcat(Str x, Str y)
} }
void void
Strcat_charp(Str x, char *y) Strcat_charp(Str x, const char *y)
{ {
if (y == NULL) if (y == NULL)
return; return;
@@ -301,7 +301,7 @@ Strinsert_char(Str s, int pos, char c)
} }
void void
Strinsert_charp(Str s, int pos, char *p) Strinsert_charp(Str s, int pos, const char *p)
{ {
STR_LENGTH_CHECK(s); STR_LENGTH_CHECK(s);
while (*p) while (*p)
+8 -8
View File
@@ -30,22 +30,22 @@ typedef struct _Str {
Str Strnew(void); Str Strnew(void);
Str Strnew_size(int); Str Strnew_size(int);
Str Strnew_charp(char *); Str Strnew_charp(const char *);
Str Strnew_charp_n(char *, int); Str Strnew_charp_n(const char *, int);
Str Strnew_m_charp(char *, ...); Str Strnew_m_charp(const char *, ...);
Str Strdup(Str); Str Strdup(Str);
void Strclear(Str); void Strclear(Str);
void Strfree(Str); void Strfree(Str);
void Strcopy(Str, Str); void Strcopy(Str, Str);
void Strcopy_charp(Str, char *); void Strcopy_charp(Str, const char *);
void Strcopy_charp_n(Str, char *, int); void Strcopy_charp_n(Str, const char *, int);
void Strcat_charp_n(Str, char *, int); void Strcat_charp_n(Str, const char *, int);
void Strcat(Str, Str); void Strcat(Str, Str);
void Strcat_charp(Str, char *); void Strcat_charp(Str, const char *);
void Strcat_m_charp(Str, ...); void Strcat_m_charp(Str, ...);
Str Strsubstr(Str, int, int); Str Strsubstr(Str, int, int);
void Strinsert_char(Str, int, char); void Strinsert_char(Str, int, char);
void Strinsert_charp(Str, int, char *); void Strinsert_charp(Str, int, const char *);
void Strdelete(Str, int, int); void Strdelete(Str, int, int);
void Strtruncate(Str, int); void Strtruncate(Str, int);
void Strlower(Str); void Strlower(Str);
+2 -2
View File
@@ -2713,7 +2713,7 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
Str line = obuf->line, pass = NULL; Str line = obuf->line, pass = NULL;
char *hidden_anchor = NULL, *hidden_img = NULL, *hidden_bold = NULL, char *hidden_anchor = NULL, *hidden_img = NULL, *hidden_bold = NULL,
*hidden_under = NULL, *hidden_italic = NULL, *hidden_strike = NULL, *hidden_under = NULL, *hidden_italic = NULL, *hidden_strike = NULL,
*hidden_ins = NULL, *hidden_input, *hidden = NULL; *hidden_ins = NULL, *hidden_input = NULL, *hidden = NULL;
#ifdef DEBUG #ifdef DEBUG
if (w3m_debug) { if (w3m_debug) {
@@ -8540,7 +8540,7 @@ lessopen_stream(char *path)
} }
c = getc(fp); c = getc(fp);
if (c == EOF) { if (c == EOF) {
fclose(fp); pclose(fp);
return NULL; return NULL;
} }
ungetc(c, fp); ungetc(c, fp);
+4 -2
View File
@@ -386,9 +386,11 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer)
cgi_basename = mybasename(file); cgi_basename = mybasename(file);
pid = open_pipe_rw(&fr, NULL); pid = open_pipe_rw(&fr, NULL);
/* Don't invoke gc after here, or the program might crash in some platforms */ /* Don't invoke gc after here, or the program might crash in some platforms */
if (pid < 0) if (pid < 0) {
if (fw)
fclose(fw);
return NULL; return NULL;
else if (pid) { } else if (pid) {
if (fw) if (fw)
fclose(fw); fclose(fw);
return fr; return fr;
+1 -1
View File
@@ -837,7 +837,7 @@ void
show_params(FILE * fp) show_params(FILE * fp)
{ {
int i, j, l; int i, j, l;
char *t = NULL; const char *t = "";
char *cmt; char *cmt;
#ifdef USE_M17N #ifdef USE_M17N