Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

Commit

Permalink
rid st compile of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
toffaletti committed Jan 14, 2011
1 parent 84ec7f3 commit 51208d2
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 34 deletions.
19 changes: 1 addition & 18 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@
#define ST_BEGIN_MACRO {
#define ST_END_MACRO }

#ifdef DEBUG
#define ST_HIDDEN /*nothing*/
#else
#define ST_HIDDEN static
#endif
#define ST_HIDDEN static

#include "public.h"
#include "md.h"
Expand Down Expand Up @@ -377,7 +373,6 @@ extern _st_eventsys_t *_st_eventsys;
*/

#ifdef DEBUG
void _st_iterate_threads(void);
#define ST_DEBUG_ITERATE_THREADS() _st_iterate_threads()
#else
#define ST_DEBUG_ITERATE_THREADS()
Expand Down Expand Up @@ -455,17 +450,5 @@ _st_stack_t *_st_stack_new(int stack_size);
void _st_stack_free(_st_stack_t *ts);
int _st_io_init(void);

st_utime_t st_utime(void);
_st_cond_t *st_cond_new(void);
int st_cond_destroy(_st_cond_t *cvar);
int st_cond_timedwait(_st_cond_t *cvar, st_utime_t timeout);
int st_cond_signal(_st_cond_t *cvar);
ssize_t st_read(_st_netfd_t *fd, void *buf, size_t nbyte, st_utime_t timeout);
ssize_t st_write(_st_netfd_t *fd, const void *buf, size_t nbyte,
st_utime_t timeout);
int st_poll(struct pollfd *pds, int npds, st_utime_t timeout);
_st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg,
int joinable, int stk_size);

#endif /* !__ST_COMMON_H__ */

6 changes: 4 additions & 2 deletions examples/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <errno.h>
#include "st.h"

#include "error.h"

/*
* Simple error reporting functions.
* Suggested in W. Richard Stevens' "Advanced Programming in UNIX
Expand Down Expand Up @@ -124,9 +126,9 @@ void err_quit(int fd, const char *fmt, ...)
/*
* Return a pointer to a string containing current time.
*/
char *err_tstamp(void)
static char *err_tstamp(void)
{
static char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
static char str[32];
static time_t lastt = 0;
Expand Down
10 changes: 10 additions & 0 deletions examples/error.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef ERROR_H
#define ERROR_H 1

extern void err_sys_report(int fd, const char *fmt, ...);
extern void err_sys_quit(int fd, const char *fmt, ...);
extern void err_sys_dump(int fd, const char *fmt, ...);
extern void err_report(int fd, const char *fmt, ...);
extern void err_quit(int fd, const char *fmt, ...);

#endif
6 changes: 2 additions & 4 deletions examples/lookupdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#include "st.h"
#include "res.h"

#if !defined(NETDB_INTERNAL) && defined(h_NETDB_INTERNAL)
#define NETDB_INTERNAL h_NETDB_INTERNAL
Expand All @@ -46,11 +47,8 @@
/* Resolution timeout (in microseconds) */
#define TIMEOUT (2*1000000LL)

/* External function defined in the res.c file */
int dns_getaddr(const char *host, struct in_addr *addr, st_utime_t timeout);


void *do_resolve(void *host)
static void *do_resolve(void *host)
{
struct in_addr addr;

Expand Down
4 changes: 4 additions & 0 deletions examples/res.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
#include <errno.h>
#include "st.h"

#include "res.h"

#define MAXPACKET 1024

#if !defined(NETDB_INTERNAL) && defined(h_NETDB_INTERNAL)
Expand All @@ -84,6 +86,8 @@
/* New in Solaris 7 */
#if !defined(_getshort) && defined(ns_get16)
#define _getshort(cp) ns_get16(cp)
#elif !defined(_getshort)
extern int _getshort(unsigned char *);
#endif

typedef union {
Expand Down
7 changes: 7 additions & 0 deletions examples/res.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef RES_H
#define RES_H 1

extern int dns_getaddr(const char *host, struct in_addr *addr, st_utime_t timeout);

#endif

12 changes: 2 additions & 10 deletions examples/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <pwd.h>
#include "st.h"

#include "error.h"

/******************************************************************
* Server configuration parameters
Expand Down Expand Up @@ -83,7 +84,7 @@

struct socket_info {
st_netfd_t nfd; /* Listening socket */
char *addr; /* Bind address */
const char *addr; /* Bind address */
unsigned int port; /* Port */
int wait_threads; /* Number of threads waiting to accept */
int busy_threads; /* Number of threads processing request */
Expand Down Expand Up @@ -166,14 +167,6 @@ extern void logbuf_open(void);
extern void logbuf_flush(void);
extern void logbuf_close(void);

/* Error reporting functions defined in the error.c file */
extern void err_sys_report(int fd, const char *fmt, ...);
extern void err_sys_quit(int fd, const char *fmt, ...);
extern void err_sys_dump(int fd, const char *fmt, ...);
extern void err_report(int fd, const char *fmt, ...);
extern void err_quit(int fd, const char *fmt, ...);


/*
* General server example: accept a client connection and do something.
* This program just outputs a short HTML page, but can be easily adapted
Expand Down Expand Up @@ -291,7 +284,6 @@ static void usage(const char *progname)

static void parse_arguments(int argc, char *argv[])
{
extern char *optarg;
int opt;
char *c;

Expand Down

0 comments on commit 51208d2

Please sign in to comment.