Multiple portability fixes

darcs-hash:20051010161255-ac50b-e732f18c1dfa610e34b56bb4ff1a3d4d2ef078a1.gz
This commit is contained in:
axel 2005-10-11 02:12:55 +10:00
parent b6e7133ba6
commit 0a4b983afa
8 changed files with 32 additions and 21 deletions

View file

@ -33,7 +33,7 @@
CC := @CC@
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= -l@CURSESLIB@ @LDFLAGS@ @LIBDIR@
LDFLAGS:= -l@CURSESLIB@ @LIBS@ @LDFLAGS@ @LIBDIR@
INSTALL:=@INSTALL@
prefix = @prefix@
@ -69,7 +69,7 @@ FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.o \
#All objects that the system needs to build mimedb
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o
#
# Files containing documentation for builtins. Should be listed

View file

@ -15,6 +15,12 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

View file

@ -9,6 +9,11 @@
#include <pwd.h>
#include <errno.h>
#include <fcntl.h>
#if HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif
#include <term.h>
#include <signal.h>

View file

@ -509,7 +509,7 @@ static void enqueue( const void *k,
{
const wchar_t *key = (const wchar_t *)k;
const var_entry_t *val = (const var_entry_t *)v;
queue_t *queue = (queue_t *)q;
dyn_queue_t *queue = (dyn_queue_t *)q;
message_t *msg = create_message( val->export?SET_EXPORT:SET, key, val->val );
msg->count=1;

View file

@ -61,7 +61,7 @@ typedef struct connection
/**
Queue of onsent messages
*/
queue_t unsent;
dyn_queue_t unsent;
/**
Set to one when this connection should be killed
*/

View file

@ -5,7 +5,7 @@
# into a C string literal.
# NAME is the name of the function we are generating documentation for.
NAME=$(basename $1 .doxygen)
NAME=`basename $1 .doxygen`
# Render the page
nroff -man doc_src/builtin_doc/man/man1/${NAME}.1 | col -b | cat -s | sed -e '$d' | ./gen_hdr2

16
util.c
View file

@ -72,20 +72,20 @@ int maxi( int a,
/* Queue functions */
void q_init( queue_t *q )
void q_init( dyn_queue_t *q )
{
q->start = (void **)malloc( sizeof(void*)*1 );
q->stop = &q->start[1];
q->put_pos = q->get_pos = q->start;
}
void q_destroy( queue_t *q )
void q_destroy( dyn_queue_t *q )
{
free( q->start );
}
/*
static q_print( queue_t *q )
static q_print( dyn_queue_t *q )
{
int i;
int size = (q->stop-q->start);
@ -106,7 +106,7 @@ void q_destroy( queue_t *q )
/**
Reallocate the queue_t
*/
static int q_realloc( queue_t *q )
static int q_realloc( dyn_queue_t *q )
{
void **old_start = q->start;
void **old_stop = q->stop;
@ -131,7 +131,7 @@ static int q_realloc( queue_t *q )
return 1;
}
int q_put( queue_t *q, void *e )
int q_put( dyn_queue_t *q, void *e )
{
*q->put_pos = e;
@ -144,7 +144,7 @@ int q_put( queue_t *q, void *e )
return 1;
}
void *q_get( queue_t *q)
void *q_get( dyn_queue_t *q)
{
void *e = *q->get_pos;
if( ++q->get_pos == q->stop )
@ -152,12 +152,12 @@ void *q_get( queue_t *q)
return e;
}
void *q_peek( queue_t *q )
void *q_peek( dyn_queue_t *q )
{
return *q->get_pos;
}
int q_empty( queue_t *q )
int q_empty( dyn_queue_t *q )
{
// fprintf( stderr, "Queue %d is %s\n", q, (q->put_pos == q->get_pos)?"empty":"non-empty" );
return q->put_pos == q->get_pos;

16
util.h
View file

@ -10,7 +10,7 @@
/**
Data structure for an automatically resizing dynamically allocated queue,
*/
typedef struct queue
typedef struct dyn_queue
{
/** Start of the array */
void **start;
@ -21,7 +21,7 @@ typedef struct queue
/** Where to remove elements */
void **get_pos;
}
queue_t;
dyn_queue_t;
/**
Internal struct used by hash_table_t.
@ -159,17 +159,17 @@ float minf( float a, float b );
element to be inserted into the buffer is the first element to be
returned.
*/
void q_init( queue_t *q );
void q_init( dyn_queue_t *q );
/** Destroy the queue */
void q_destroy( queue_t *q );
void q_destroy( dyn_queue_t *q );
/** Insert element into queue */
int q_put( queue_t *q, void *e );
int q_put( dyn_queue_t *q, void *e );
/** Remove and return next element from queue */
void *q_get( queue_t *q);
void *q_get( dyn_queue_t *q);
/** Return next element from queue without removing it */
void *q_peek( queue_t *q);
void *q_peek( dyn_queue_t *q);
/** Returns 1 if the queue is empty, 0 otherwise */
int q_empty( queue_t *q );
int q_empty( dyn_queue_t *q );
/**
Initialize a hash table. The hash function must never return the value 0.