pike.git / src / modules / Wnotify / wnotify.cmod

version» Context lines:

pike.git/src/modules/Wnotify/wnotify.cmod:1: + /* -*- c -*- + || This file is part of Pike. For copyright information see COPYRIGHT. + || Pike is distributed under GPL, LGPL and MPL. See the file COPYING + || for more information. + */ +    /*! @module System    */      /*! @module Wnotify    *!    *! An interface to Windows filesystem change information.    *!    */      #include "global.h"
pike.git/src/modules/Wnotify/wnotify.cmod:141:    CVAR int handles_used;       /*! @decl void add_handle(NotificationHandle handle)    */    PIKEFUN void add_handle(object handle)    {    void * h;    int s, n;    struct array * ph;    HANDLE nh; -  HANDLE * handles; +     h = get_storage(handle, Wnotify_NotificationHandle_program);    if(!h)    {    pop_stack();    Pike_error("add_handle: invalid object type.\n");    }       ph = append_array(THIS->phandles, &Pike_sp[-args]);    THIS->phandles = ph;    nh = OBJ2_WNOTIFY_NOTIFICATIONHANDLE(handle)->handle;       if(THIS->handles_size <= THIS->handles_used)    {    s = n = THIS->handles_size || 1;    s*=2; -  handles = realloc(THIS->handles, sizeof(HANDLE) * s); -  if(!handles) -  { -  pop_stack(); -  Pike_error("add_handle: failed to allocate memory.\n"); +  THIS->handles = xrealloc(THIS->handles, sizeof(HANDLE) * s);    }    -  THIS->handles = handles; -  } -  +     THIS->handles[THIS->handles_used++] = nh;       pop_stack();    }       /*! @decl NotificationHandle|int poll(void|float timeout)    */    PIKEFUN int poll(void|float timeout)    {    DWORD res;