--- libcoro/coro.h 2006/02/19 22:30:58 1.13 +++ libcoro/coro.h 2006/11/26 03:18:51 1.17 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2005 Marc Alexander Lehmann + * Copyright (c) 2001-2006 Marc Alexander Lehmann * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: @@ -35,6 +35,12 @@ * */ +/* + * 2006-10-26 Include stddef.h on OS X to work around one of its bugs. + * Reported by Michael_G_Schwern. + * 2006-11-26 Use _setjmp instead of setjmp on GNU/Linux. + */ + #ifndef CORO_H #define CORO_H @@ -97,7 +103,7 @@ /* * A coroutine state is saved in the following structure. Treat it as a * opaque type. errno and sigmask might be saved, but don't rely on it, - * implement your own switching primitive. + * implement your own switching primitive if you need it. */ typedef struct coro_context coro_context; @@ -165,7 +171,11 @@ jmp_buf env; }; -#define coro_transfer(p,n) do { if (!setjmp ((p)->env)) longjmp ((n)->env, 1); } while(0) +#if CORO_LINUX +# define coro_transfer(p,n) do { if (!_setjmp ((p)->env)) _longjmp ((n)->env, 1); } while(0) +#else +# define coro_transfer(p,n) do { if (!setjmp ((p)->env)) longjmp ((n)->env, 1); } while(0) +#endif #endif