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