Branch: Tag:

2011-10-28

2011-10-28 13:04:55 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Atomic megapatch: Use svalue accessor macros everywhere.

212:    */   static void push_callback(ptrdiff_t no)   { -  add_ref(Pike_sp->u.object=THISOBJ); -  Pike_sp->subtype = DO_NOT_WARN(no + Pike_fp->context->identifier_level); -  Pike_sp->type = T_FUNCTION; +  SET_SVAL(*Pike_sp, T_FUNCTION, +  DO_NOT_WARN(no + Pike_fp->context->identifier_level), +  object, THISOBJ); +  add_ref(THISOBJ);    Pike_sp++;   }   
282:   /* do the done_callback, then close and free everything */   static INLINE void pipe_done(void)   { -  if (THIS->done_callback.type!=T_INT) +  if (TYPEOF(THIS->done_callback) != T_INT)    {    assign_svalue_no_free(sp++,&THIS->id);    apply_svalue(&(THIS->done_callback),1);
411:    push_int(8192);    push_int(1); /* We don't care if we don't get all 8192 bytes. */    apply(i->u.obj, "read", 2); -  if ((sp[-1].type == T_STRING) && (sp[-1].u.string->len > 0)) { +  if ((TYPEOF(sp[-1]) == T_STRING) && (sp[-1].u.string->len > 0)) {    append_buffer(sp[-1].u.string);    pop_stack();    THIS->sleeping = 1;
695:    out->mode=O_RUN;       ret=-1; -  if(sp[-1].type == T_INT) ret=sp[-1].u.integer; +  if(TYPEOF(sp[-1]) == T_INT) ret=sp[-1].u.integer;    pop_stack();       if (ret==-1) /* error, byebye */
723:    int fd=-1; /* Per, one less warning to worry about... */    struct object *obj;    -  if (args<1 || sp[-args].type != T_OBJECT) +  if (args<1 || TYPEOF(sp[-args]) != T_OBJECT)    Pike_error("Bad/missing argument 1 to pipe->input().\n");       obj=sp[-args].u.object;
745: Inside #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
   struct stat s;       apply(obj, "query_fd", 0); -  if(sp[-1].type == T_INT) fd=sp[-1].u.integer; +  if(TYPEOF(sp[-1]) == T_INT) fd=sp[-1].u.integer;    pop_stack();       if (fd != -1 && fstat(fd,&s)==0)
836:   {    struct input *i;    -  if (args<1 || sp[-args].type!=T_STRING) +  if (args<1 || TYPEOF(sp[-args]) != T_STRING)    Pike_error("illegal argument to pipe->write()\n");       if (!THIS->firstinput)
869:    struct buffer *b;       if (args<1 || -  sp[-args].type != T_OBJECT || +  TYPEOF(sp[-args]) != T_OBJECT ||    !sp[-args].u.object ||    !sp[-args].u.object->prog)    Pike_error("Bad/missing argument 1 to pipe->output().\n");       if (args==2 && -  sp[1-args].type != T_INT) +  TYPEOF(sp[1-args]) != T_INT)    Pike_error("Bad argument 2 to pipe->output().\n");       if (THIS->fd==-1) /* no buffer */
883:    /* test if usable as buffer */    apply(sp[-args].u.object,"query_fd",0);    -  if ((sp[-1].type==T_INT) +  if ((TYPEOF(sp[-1]) == T_INT)    && (fd=sp[-1].u.integer)>=0    && (fstat(fd,&s)==0)    && S_ISREG(s.st_mode)
993:    if (args==0)    {    free_svalue(&THIS->done_callback); -  THIS->done_callback.type=T_INT; +  SET_SVAL_TYPE(THIS->done_callback, T_INT);    return;    } -  if (args<1 || (sp[-args].type!=T_FUNCTION && sp[-args].type!=T_ARRAY)) +  if (args<1 || (TYPEOF(sp[-args]) != T_FUNCTION && +  TYPEOF(sp[-args]) != T_ARRAY))    Pike_error("Illegal argument to set_done_callback()\n");       if (args>1)
1021:    if (args==0)    {    free_svalue(&THIS->output_closed_callback); -  THIS->output_closed_callback.type=T_INT; +  SET_SVAL_TYPE(THIS->output_closed_callback, T_INT);    return;    } -  if (args<1 || (sp[-args].type!=T_FUNCTION && sp[-args].type!=T_ARRAY)) +  if (args<1 || (TYPEOF(sp[-args]) != T_FUNCTION && +  TYPEOF(sp[-args]) != T_ARRAY))    Pike_error("Illegal argument to set_output_closed_callback()\n");       if (args>1)
1073:      static void pipe_write_output_callback(INT32 args)   { -  if (args<1 || sp[-args].type!=T_OBJECT) +  if (args<1 || TYPEOF(sp[-args]) != T_OBJECT)    Pike_error("Illegal argument to pipe->write_output_callback\n");       if(!sp[-args].u.object->prog) return;
1089:   static void pipe_close_output_callback(INT32 args)   {    struct output *o; -  if (args<1 || sp[-args].type!=T_OBJECT) +  if (args<1 || TYPEOF(sp[-args]) != T_OBJECT)       if(!sp[-args].u.object->prog) return;   
1098:       o=(struct output *)(sp[-args].u.object->storage);    -  if (THIS->output_closed_callback.type!=T_INT) +  if (TYPEOF(THIS->output_closed_callback) != T_INT)    {    assign_svalue_no_free(sp++,&THIS->id);    push_object(o->obj);
1115:    struct input *i;    struct pike_string *s;    -  if (args<2 || sp[1-args].type!=T_STRING) +  if (args<2 || TYPEOF(sp[1-args]) != T_STRING)    Pike_error("Illegal argument to pipe->read_input_callback\n");       i=THIS->firstinput;
1243:    free_svalue(& p->output_closed_callback);    free_svalue(& p->id);    -  p->done_callback.type=T_INT; -  p->output_closed_callback.type=T_INT; -  p->id.type=T_INT; +  SET_SVAL_TYPE(p->done_callback, T_INT); +  SET_SVAL_TYPE(p->output_closed_callback, T_INT); +  SET_SVAL_TYPE(p->id, T_INT);       /* p->done=0; */   }
1262:    THIS->sleeping=0;    THIS->done=0;    THIS->fd=-1; -  THIS->done_callback.type=T_INT; -  THIS->output_closed_callback.type=T_INT; -  THIS->id.type=T_INT; +  SET_SVAL_TYPE(THIS->done_callback, T_INT); +  SET_SVAL_TYPE(THIS->output_closed_callback, T_INT); +  SET_SVAL_TYPE(THIS->id, T_INT);    THIS->id.u.integer=0;    THIS->living_outputs=0;    THIS->sent=0;