pike.git / src / modules / _Stdio / file.c

version» Context lines:

pike.git/src/modules/_Stdio/file.c:248:      static struct my_file *get_file_storage(struct object *o)   {    struct my_file *f;    struct svalue *sval;    struct object *ob;    if(o->prog == file_program)    return ((struct my_file *)    (o->storage + file_program->inherits->storage_offset));    -  if((f=(struct my_file *)get_storage(o,file_program))) +  if((f=get_storage(o,file_program)))    return f;    -  if((sval=(struct svalue *)get_storage(o,file_ref_program))) { +  if((sval=get_storage(o,file_ref_program))) {    if (TYPEOF(*sval) == PIKE_T_OBJECT) {    ob = sval->u.object;    /* FIXME: Use the subtype information! */ -  if(ob && (f=(struct my_file *)get_storage(ob, file_program))) +  if(ob && (f=get_storage(ob, file_program)))    return f;    }    }       return 0;   }      #ifdef PIKE_DEBUG   static void debug_check_internals (struct my_file *f)   {    size_t ev;    -  if (f->box.ref_obj->prog && file_program && -  !get_storage(f->box.ref_obj,file_program)) +  if )    Pike_fatal ("ref_obj is not a file object.\n");       for (ev = 0; ev < NELEM (f->event_cbs); ev++)    if (TYPEOF(f->event_cbs[ev]) == PIKE_T_INT &&    f->box.backend && f->box.events & (1 << ev))    Pike_fatal ("Got event flag but no callback for event %"PRINTSIZET"d.\n", ev);   }   #else   #define debug_check_internals(f) do {} while (0)   #endif
pike.git/src/modules/_Stdio/file.c:3754:    */   static void file_set_backend (INT32 args)   {    struct my_file *f = THIS;    struct Backend_struct *backend;       if (!args)    SIMPLE_TOO_FEW_ARGS_ERROR ("Stdio.File->set_backend", 1);    if (TYPEOF(Pike_sp[-args]) != PIKE_T_OBJECT)    SIMPLE_BAD_ARG_ERROR ("Stdio.File->set_backend", 1, "object(Pike.Backend)"); -  backend = (struct Backend_struct *) -  get_storage (Pike_sp[-args].u.object, Backend_program); +  backend = get_storage (Pike_sp[-args].u.object, Backend_program);    if (!backend)    SIMPLE_BAD_ARG_ERROR ("Stdio.File->set_backend", 1, "object(Pike.Backend)");       /* FIXME: Only allow set_backend() if the file is open? */      #ifdef __NT__    if ((THIS->box.fd >= 0) &&    !(fd_query_properties(THIS->box.fd, fd_CAN_NONBLOCK) & fd_CAN_NONBLOCK)) {    Pike_error("set_backend() on non-socket!\n");    }