shmalloc: Make it build in non-glib world

This commit is contained in:
Olivier Crête 2010-01-28 15:34:44 +02:00
parent c8eb511a9d
commit 807da2165a
3 changed files with 17 additions and 4 deletions

View file

@ -15,8 +15,8 @@
#else
#define spalloc_new0(type) malloc (sizeof (type))
#define spalloc_alloc0(size) malloc (size)
#define spalloc_new(type) malloc (sizeof (type))
#define spalloc_alloc(size) malloc (size)
#define spalloc_free(type, buf) free (buf)
#define spalloc_free1(size, buf) free (buf)
@ -39,4 +39,9 @@ void shm_alloc_space_block_dec (ShmAllocBlock * block);
ShmAllocBlock * shm_alloc_space_block_get (ShmAllocSpace * space,
unsigned long offset);
#ifdef __cplusplus
}
#endif
#endif /* __SHMALLOC_H__ */

View file

@ -466,7 +466,7 @@ sp_writer_free_block (ShmBlock * block)
/* Returns the number of client this has successfully been sent to */
int
sp_writer_send_buf (ShmPipe * self, gchar * buf, size_t size)
sp_writer_send_buf (ShmPipe * self, char * buf, size_t size)
{
ShmArea *area = NULL;
unsigned long offset = 0;
@ -562,7 +562,6 @@ sp_client_recv (ShmPipe * self, char **buf)
cb.payload.new_shm_area.path_size, 0);
if (retval != cb.payload.new_shm_area.path_size) {
free (area_name);
g_debug ("retval: %d, errno: %d", retval, errno);
return -3;
}

View file

@ -37,6 +37,11 @@
#include <sys/stat.h>
#include <fcntl.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _ShmClient ShmClient;
typedef struct _ShmPipe ShmPipe;
typedef struct _ShmBlock ShmBlock;
@ -65,4 +70,8 @@ ShmPipe *sp_client_open (const char *path);
unsigned long sp_client_recv (ShmPipe * self, char **buf);
int sp_client_recv_finish (ShmPipe * self, char *buf);
#ifdef __cplusplus
}
#endif
#endif /* __SHMPIPE_H__ */