Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang warnings #26

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ static aligned realspace[SPACE / ALIGNMENT];
#define space ((char *) realspace)
static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */

/*@null@*//*@out@*/char *alloc(n)
unsigned int n;
/*@null@*//*@out@*/char *alloc(unsigned int n)
{
char *x;
n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
Expand All @@ -23,8 +22,7 @@ unsigned int n;
return x;
}

void alloc_free(x)
char *x;
void alloc_free(char *x)
{
if (x >= space)
if (x < space + SPACE)
Expand Down
6 changes: 3 additions & 3 deletions src/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#ifndef ALLOC_H
#define ALLOC_H

extern /*@null@*//*@out@*/char *alloc();
extern void alloc_free();
extern int alloc_re();
extern /*@null@*//*@out@*/char *alloc(unsigned int n);
extern void alloc_free(char *x);
extern int alloc_re(char **x, unsigned int m, unsigned int n);

#endif
5 changes: 1 addition & 4 deletions src/alloc_re.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#include "alloc.h"
#include "byte.h"

int alloc_re(x,m,n)
char **x;
unsigned int m;
unsigned int n;
int alloc_re(char **x, unsigned int m, unsigned int n)
{
char *y;

Expand Down
11 changes: 5 additions & 6 deletions src/byte.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
#ifndef BYTE_H
#define BYTE_H

extern unsigned int byte_chr();
extern unsigned int byte_rchr();
extern void byte_copy();
extern void byte_copyr();
extern int byte_diff();
extern void byte_zero();
extern unsigned int byte_chr(char *s, register unsigned int n, int c);
extern unsigned int byte_rchr(char *s, register unsigned int n, int c);
extern void byte_copy(register char *to, register unsigned int n, register char *from);
extern void byte_copyr(register char *to, register unsigned int n, register char *from);
extern int byte_diff(register char *s, register unsigned int n, register char *t);

#define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))

Expand Down
5 changes: 1 addition & 4 deletions src/byte_chr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

#include "byte.h"

unsigned int byte_chr(s,n,c)
char *s;
register unsigned int n;
int c;
unsigned int byte_chr(char *s, register unsigned int n, int c)
{
register char ch;
register char *t;
Expand Down
5 changes: 1 addition & 4 deletions src/byte_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

#include "byte.h"

void byte_copy(to,n,from)
register char *to;
register unsigned int n;
register char *from;
void byte_copy(register char *to, register unsigned int n, register char *from)
{
for (;;) {
if (!n) return; *to++ = *from++; --n;
Expand Down
5 changes: 1 addition & 4 deletions src/byte_cr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

#include "byte.h"

void byte_copyr(to,n,from)
register char *to;
register unsigned int n;
register char *from;
void byte_copyr(register char *to, register unsigned int n, register char *from)
{
to += n;
from += n;
Expand Down
5 changes: 1 addition & 4 deletions src/byte_diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

#include "byte.h"

int byte_diff(s,n,t)
register char *s;
register unsigned int n;
register char *t;
int byte_diff(register char *s, register unsigned int n, register char *t)
{
for (;;) {
if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
Expand Down
5 changes: 1 addition & 4 deletions src/byte_rchr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

#include "byte.h"

unsigned int byte_rchr(s,n,c)
char *s;
register unsigned int n;
int c;
unsigned int byte_rchr(char *s, register unsigned int n, int c)
{
register char ch;
register char *t;
Expand Down
6 changes: 2 additions & 4 deletions src/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
#ifndef WAIT_H
#define WAIT_H

extern int wait_pid();
extern int wait_nohang();
extern int wait_stop();
extern int wait_stopnohang();
extern int wait_pid(int *wstat, int pid);
extern int wait_nohang(int *wstat);

#define wait_crashed(w) ((w) & 127)
#define wait_exitcode(w) ((w) >> 8)
Expand Down
2 changes: 1 addition & 1 deletion src/wait_nohang.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <sys/wait.h>
#include "haswaitp.h"

int wait_nohang(wstat) int *wstat;
int wait_nohang(int *wstat)
{
#ifdef HASWAITPID
return waitpid(-1,wstat,WNOHANG);
Expand Down
4 changes: 2 additions & 2 deletions src/wait_pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#ifdef HASWAITPID

int wait_pid(wstat,pid) int *wstat; int pid;
int wait_pid(int *wstat, int pid)
{
int r;

Expand All @@ -24,7 +24,7 @@ int wait_pid(wstat,pid) int *wstat; int pid;
static int oldpid = 0;
static int oldwstat; /* defined if(oldpid) */

int wait_pid(wstat,pid) int *wstat; int pid;
int wait_pid(int *wstat, int pid)
{
int r;

Expand Down