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

version» Context lines:

pike.git/src/post_modules/Shuffler/a_source_stdio_buffer.c:19:         /* Source: Stdio.Buffer object    * Argument: Stdio.Buffer lookalike with read_buffer and consume    */      struct sb_source   {    struct source s;    -  off_t lastlen; +     struct object *obj;   };      static struct data get_data( struct source *src, off_t len )   {    struct sb_source *s = (struct sb_source *)src;    struct data res; -  +     Buffer *io = io_buffer_from_object(s->obj);    -  io_consume(io, s->lastlen); +     res.data = io_read_pointer(io); -  s->lastlen = res.len = len = len > io_len(io) ? io_len(io) : len; -  -  s->s.eof = !len; +  res.len = io_len(io); +  s->s.eof = 1;    return res;   }      static void free_source( struct source *src )   {    struct sb_source *s = (struct sb_source *)src;    free_object(s->obj);   }      struct source *source_stdio_buffer_make( struct svalue *s,
pike.git/src/post_modules/Shuffler/a_source_stdio_buffer.c:85:    push_int64(len);    apply(o, "read_buffer", 1);    }       if (TYPEOF(Pike_sp[-1]) != PIKE_T_OBJECT)    Pike_error("Some data went missing.\n");       o = Pike_sp[-1].u.object;    Pike_sp--;    -  res->lastlen = 0; +     res->s.get_data = get_data;    res->s.free_source = free_source;    add_ref(res->obj = o);    return (struct source *)res;   }      void source_stdio_buffer_exit( )   {   }      void source_stdio_buffer_init( )   {   }