@@ -98,13 +98,13 @@ cucul_canvas_t * cucul_create_canvas(unsigned int width, unsigned int height) | |||
if(ret < 0) | |||
{ | |||
#if defined(HAVE_ERRNO_H) && !defined(__KERNEL__) | |||
#if defined(HAVE_ERRNO_H) | |||
int saved_errno = errno; | |||
#endif | |||
free(cv->allattr); | |||
free(cv->allchars); | |||
free(cv); | |||
#if defined(HAVE_ERRNO_H) && !defined(__KERNEL__) | |||
#if defined(HAVE_ERRNO_H) | |||
errno = saved_errno; | |||
#endif | |||
return NULL; | |||
@@ -116,7 +116,7 @@ cucul_canvas_t * cucul_create_canvas(unsigned int width, unsigned int height) | |||
return cv; | |||
nomem: | |||
#if defined(HAVE_ERRNO_H) && !defined(__KERNEL__) | |||
#if defined(HAVE_ERRNO_H) | |||
errno = ENOMEM; | |||
#endif | |||
return NULL; | |||
@@ -152,7 +152,7 @@ int cucul_set_canvas_size(cucul_canvas_t *cv, unsigned int width, | |||
{ | |||
if(cv->refcount) | |||
{ | |||
#if defined(HAVE_ERRNO_H) && !defined(__KERNEL__) | |||
#if defined(HAVE_ERRNO_H) | |||
errno = EBUSY; | |||
#endif | |||
return -1; | |||
@@ -246,7 +246,7 @@ int cucul_free_canvas(cucul_canvas_t *cv) | |||
if(cv->refcount) | |||
{ | |||
#if defined(HAVE_ERRNO_H) && !defined(__KERNEL__) | |||
#if defined(HAVE_ERRNO_H) | |||
errno = EBUSY; | |||
#endif | |||
return -1; | |||
@@ -316,7 +316,7 @@ int _cucul_set_canvas_size(cucul_canvas_t *cv, unsigned int width, | |||
new_size * sizeof(uint32_t)); | |||
if(!cv->allchars[f] || !cv->allattr[f]) | |||
{ | |||
#if defined(HAVE_ERRNO_H) && !defined(__KERNEL__) | |||
#if defined(HAVE_ERRNO_H) | |||
errno = ENOMEM; | |||
#endif | |||
return -1; | |||
@@ -405,7 +405,7 @@ int _cucul_set_canvas_size(cucul_canvas_t *cv, unsigned int width, | |||
new_size * sizeof(uint32_t)); | |||
if(!cv->allchars[f] || !cv->allattr[f]) | |||
{ | |||
#if defined(HAVE_ERRNO_H) && !defined(__KERNEL__) | |||
#if defined(HAVE_ERRNO_H) | |||
errno = ENOMEM; | |||
#endif | |||
return -1; | |||
@@ -2,6 +2,7 @@ | |||
* libcucul Canvas for ultrafast compositing of Unicode letters | |||
* libcaca Colour ASCII-Art library | |||
* Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||
* 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
* All Rights Reserved | |||
* | |||
* $Id$ | |||
@@ -332,6 +333,10 @@ double sqrt(double x) | |||
return ret; | |||
} | |||
/* errno.h stuff */ | |||
int errno = 0; | |||
/* arpa/inet.h functions */ | |||
/* XXX FIXME Converts only from little endian to big endian (x86) */ | |||
unsigned int htonl(unsigned int hostlong) | |||
@@ -345,6 +350,4 @@ unsigned short htons(unsigned short hostlong) | |||
return ((hostlong&0xFF00)>>8)|((hostlong&0x00FF)<<8); | |||
} | |||
#endif /* __KERNEL__ */ |
@@ -17,8 +17,6 @@ | |||
* that must be used when building libcucul and libcaca into a kernel. | |||
*/ | |||
#ifndef __KERNEL_H_ | |||
#define __KERNEL_H_ | |||
/* Various defines */ | |||
#define NULL ((void *)0) | |||
#define BUFSIZ 4096 | |||
@@ -108,7 +106,6 @@ int sscanf(const char *str, const char *format, ...); | |||
void usleep(unsigned long usec); | |||
int getpid(void); | |||
/* time.h functions */ | |||
int gettimeofday(struct timeval *tv, struct timezone *tz); | |||
int time(void *); | |||
@@ -118,8 +115,17 @@ double cos(double x); | |||
double sin(double x); | |||
double sqrt(double x); | |||
/* errno.h functions */ | |||
#define ENOENT 2 /* No such file or directory */ | |||
#define ENOMEM 12 /* Out of memory */ | |||
#define EBUSY 16 /* Device or resource busy */ | |||
#define ENODEV 19 /* No such device */ | |||
#define EINVAL 22 /* Invalid argument */ | |||
#define ENOTTY 25 /* Not a typewriter */ | |||
#define ENOSYS 38 /* Function not implemented */ | |||
extern int errno; | |||
/* arpa/inet.h functions */ | |||
unsigned int htonl(unsigned int hostlong); | |||
unsigned short htons(unsigned short hostlong); | |||
#endif /* __KERNEL_H_ */ |