pike.git / src / post_modules / Shuffler / d_source_pikestream.c

version» Context lines:

pike.git/src/post_modules/Shuffler/d_source_pikestream.c:33:    struct source s;       struct object *self;    struct object *obj;    struct pike_string *str;    char *data;    size_t available;    int eof;       void (*when_data_cb)( void *a ); -  void *when_data_cb_arg; +  struct object *when_data_cb_arg;    size_t len, skip;   };      static void setup_callbacks( struct source *src )   {    struct pf_source *s = (struct pf_source *)src;    ref_push_object(s->self);    apply(s->obj, "set_read_callback", 1);    pop_stack();    ref_push_object(s->self);
pike.git/src/post_modules/Shuffler/d_source_pikestream.c:127:    s->available = slen -= s->skip;    s->data = s->str->str + s->skip;    s->skip = 0;    Pike_sp--;    args--;    } else {    s->skip -= slen;    s->str = 0;    }    pop_n_elems(args); - cb: if( s->when_data_cb ) -  s->when_data_cb( s->when_data_cb_arg ); + cb: if (s->when_data_cb) +  s->when_data_cb(s->when_data_cb_arg);    }       push_int(0);   }    - static void set_callback( struct source *src, void (*cb)( void *a ), void *a ) - { + static void +  set_callback(struct source *src, void (*cb)( void *a ), struct object *a) {    struct pf_source *s = (struct pf_source *)src;    s->when_data_cb = cb; -  s->when_data_cb_arg = a; +  if (!s->when_data_cb_arg) +  add_ref(s->when_data_cb_arg = a);   }      static void free_source( struct source *src ) {    free_object(((struct pf_source *)src)->self);   }      struct source *source_pikestream_make(struct svalue *sv,    INT64 start, INT64 len) {    struct pf_source *s;   
pike.git/src/post_modules/Shuffler/d_source_pikestream.c:179:    s->s.setup_callbacks = setup_callbacks;    s->s.remove_callbacks = remove_callbacks;       return (struct source *)s;   }      static void source_destruct(struct object *UNUSED(o)) {    remove_callbacks((struct source*)THIS);    free_object(THIS->obj);    THIS->obj = 0; +  if (THIS->when_data_cb_arg) +  free_object(THIS->when_data_cb_arg);   }      void source_pikestream_exit() {    free_program(source_program);   }      void source_pikestream_init() {    start_new_program();    ADD_STORAGE(struct pf_source);    ADD_FUNCTION("`()", f_got_data, tFunc(tInt tStr,tVoid),0);    set_exit_callback(source_destruct);    source_program = end_program();   }