ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.223 by root, Sun Apr 6 14:34:50 2008 UTC vs.
Revision 1.226 by root, Fri Apr 18 17:16:44 2008 UTC

360 perror (msg); 360 perror (msg);
361 abort (); 361 abort ();
362 } 362 }
363} 363}
364 364
365static void *
366ev_realloc_emul (void *ptr, long size)
367{
368 /* some systems, notably openbsd and darwin, fail to properly
369 * implement realloc (x, 0) (as required by both ansi c-98 and
370 * the single unix specification, so work around them here.
371 */
372
373 if (size)
374 return realloc (ptr, size);
375
376 free (ptr);
377 return 0;
378}
379
365static void *(*alloc)(void *ptr, long size); 380static void *(*alloc)(void *ptr, long size) = ev_realloc_emul;
366 381
367void 382void
368ev_set_allocator (void *(*cb)(void *ptr, long size)) 383ev_set_allocator (void *(*cb)(void *ptr, long size))
369{ 384{
370 alloc = cb; 385 alloc = cb;
371} 386}
372 387
373inline_speed void * 388inline_speed void *
374ev_realloc (void *ptr, long size) 389ev_realloc (void *ptr, long size)
375{ 390{
376 ptr = alloc ? alloc (ptr, size) : realloc (ptr, size); 391 ptr = alloc (ptr, size);
377 392
378 if (!ptr && size) 393 if (!ptr && size)
379 { 394 {
380 fprintf (stderr, "libev: cannot allocate %ld bytes, aborting.", size); 395 fprintf (stderr, "libev: cannot allocate %ld bytes, aborting.", size);
381 abort (); 396 abort ();
1170 if (!(flags & EVFLAG_NOENV) 1185 if (!(flags & EVFLAG_NOENV)
1171 && !enable_secure () 1186 && !enable_secure ()
1172 && getenv ("LIBEV_FLAGS")) 1187 && getenv ("LIBEV_FLAGS"))
1173 flags = atoi (getenv ("LIBEV_FLAGS")); 1188 flags = atoi (getenv ("LIBEV_FLAGS"));
1174 1189
1175 if (!(flags & 0x0000ffffUL)) 1190 if (!(flags & 0x0000ffffU))
1176 flags |= ev_recommended_backends (); 1191 flags |= ev_recommended_backends ();
1177 1192
1178#if EV_USE_PORT 1193#if EV_USE_PORT
1179 if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); 1194 if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags);
1180#endif 1195#endif
1268#endif 1283#endif
1269 1284
1270 backend = 0; 1285 backend = 0;
1271} 1286}
1272 1287
1288#if EV_USE_INOTIFY
1273void inline_size infy_fork (EV_P); 1289void inline_size infy_fork (EV_P);
1290#endif
1274 1291
1275void inline_size 1292void inline_size
1276loop_fork (EV_P) 1293loop_fork (EV_P)
1277{ 1294{
1278#if EV_USE_PORT 1295#if EV_USE_PORT

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines