Branch: Tag:

2016-01-26

2016-01-26 19:38:42 by Martin Nilsson <nilsson@fastmail.com>

SIMPLE_BAD_ARG_ERROR is only kept for compatibility, but we still had 500+ uses of it.

666:    int i;       if (!(p = program_from_svalue(Pike_sp - args))) -  SIMPLE_BAD_ARG_ERROR("_describe_program", 1, "program"); +  SIMPLE_ARG_TYPE_ERROR("_describe_program", 1, "program");       for (i=0; i < (int)p->num_identifier_references;i++) {    struct reference *ref = p->identifier_references + i;
791:    }    }    if(TYPEOF(*x) != T_INT) -  SIMPLE_BAD_ARG_ERROR("int2char", 1, "int"); +  SIMPLE_ARG_TYPE_ERROR("int2char", 1, "int");       c=x->u.integer;   
848:    }    }    if(TYPEOF(*x) != T_INT) -  SIMPLE_BAD_ARG_ERROR("int2hex", 1, "int"); +  SIMPLE_ARG_TYPE_ERROR("int2hex", 1, "int");       c=x->u.integer;   
1248:    HANDLE_PARAM (NAME, { \    if (TYPEOF(*set) != T_FLOAT || \    set->u.float_number < 0.0 || set->u.float_number > 1.0) \ -  SIMPLE_BAD_ARG_ERROR ("gc_parameters", 1, \ +  SIMPLE_ARG_TYPE_ERROR ("gc_parameters", 1, \    "float between 0.0 and 1.0 for " NAME); \    VAR = (double) set->u.float_number; \    }, { \
1257:       HANDLE_PARAM ("enabled", {    if (TYPEOF(*set) != T_INT || set->u.integer < -1 || set->u.integer > 1) -  SIMPLE_BAD_ARG_ERROR ("gc_parameters", 1, +  SIMPLE_ARG_TYPE_ERROR ("gc_parameters", 1,    "integer in the range -1..1 for 'enabled'");    if (gc_enabled != set->u.integer) {    if (gc_enabled > 0) {
1827:    int id = FIND_LFUN(p->inherits[SUBTYPEOF(*map)].prog, LFUN__M_DELETE);       if( id == -1 ) -  SIMPLE_BAD_ARG_ERROR("m_delete", 1, "object containing the _m_delete method"); +  SIMPLE_ARG_TYPE_ERROR("m_delete", 1, "object containing the _m_delete method");       apply_low(map->u.object,    id + p->inherits[SUBTYPEOF(*map)].identifier_level, 1);    stack_swap();    pop_stack();    } else { -  SIMPLE_BAD_ARG_ERROR("m_delete", 1, "object|mapping"); +  SIMPLE_ARG_TYPE_ERROR("m_delete", 1, "object|mapping");    }   }   
1908:    switch(TYPEOF(*func))    {    default: -  SIMPLE_BAD_ARG_ERROR("function_name", 1, "function|program"); +  SIMPLE_ARG_TYPE_ERROR("function_name", 1, "function|program");    UNREACHABLE(return);       case PIKE_T_PROGRAM:
2017:          default: -  SIMPLE_BAD_ARG_ERROR("function_object",1,"function"); +  SIMPLE_ARG_TYPE_ERROR("function_object",1,"function");    }    pop_n_elems(args);    push_int(0);
2071:    break;       default: -  SIMPLE_BAD_ARG_ERROR("function_program", 1, "function"); +  SIMPLE_ARG_TYPE_ERROR("function_program", 1, "function");    }    pop_n_elems(args);    push_int(0);
2163:    rawtype tFunc(tArr(tSetvar(0,tMix)),tVar(0));    {    if(!a->size) -  SIMPLE_BAD_ARG_ERROR("random", 1, "array with elements in it"); +  SIMPLE_ARG_TYPE_ERROR("random", 1, "array with elements in it");    push_svalue(a->item + (read_int(a->size)));    }   
2171:    rawtype tFunc(tSet(tSetvar(1,tMix)),tVar(1));    {    if(multiset_is_empty (m)) -  SIMPLE_BAD_ARG_ERROR("random", 1, "multiset with elements in it"); +  SIMPLE_ARG_TYPE_ERROR("random", 1, "multiset with elements in it");    push_multiset_index (m, multiset_get_nth (m, read_int(multiset_sizeof (m))));    sub_msnode_ref (m);    }
2185:    int e, count;       if(!m_sizeof(m)) -  SIMPLE_BAD_ARG_ERROR("random", 1, "mapping with elements in it"); +  SIMPLE_ARG_TYPE_ERROR("random", 1, "mapping with elements in it");       count = read_int( m_sizeof(m) );   
2759:    if (TYPEOF(*value) != PIKE_T_STRING) {    if ((TYPEOF(*value) != PIKE_T_INT) ||    (value->u.integer)) { -  SIMPLE_BAD_ARG_ERROR("`[]=", 2, "string|int(0..0)"); +  SIMPLE_ARG_TYPE_ERROR("`[]=", 2, "string|int(0..0)");    }    if (THIS->filename) {    free_string(THIS->filename);
2777:    case 1: /* Linenumber */    if (THIS->lineno == -1) fill_in_file_and_line();    if (TYPEOF(*value) != PIKE_T_INT) -  SIMPLE_BAD_ARG_ERROR("`[]=", 2, "int(1..)"); +  SIMPLE_ARG_TYPE_ERROR("`[]=", 2, "int(1..)");    THIS->lineno = value->u.integer;    break;   
3184:    a = Pike_sp[j-args].u.string;    else if ((TYPEOF(Pike_sp[j-args]) != PIKE_T_OBJECT) ||    (Pike_sp[j-args].u.object->prog != Buffer_program)) -  SIMPLE_BAD_ARG_ERROR("add", j+1, "string|String.Buffer"); +  SIMPLE_ARG_TYPE_ERROR("add", j+1, "string|String.Buffer");    else {    a = OBJ2_BUFFER(Pike_sp[j-args].u.object)->str.s;    if (!a) continue;
3444:       case 2:    if (TYPEOF(*from_arg) != T_ARRAY) { -  SIMPLE_BAD_ARG_ERROR("replace", 1, +  SIMPLE_ARG_TYPE_ERROR("replace", 1,    "array(string)|mapping(string:string)");    }    if (TYPEOF(*to_arg) == T_STRING) {
3453:    f_allocate(2);    }    if (TYPEOF(*to_arg) != T_ARRAY) { -  SIMPLE_BAD_ARG_ERROR("replace", 2, "array(string)|string"); +  SIMPLE_ARG_TYPE_ERROR("replace", 2, "array(string)|string");    }    if (from_arg->u.array->size != to_arg->u.array->size) {    Pike_error("Replace must have equal-sized from and to arrays.\n");
3469:       if( (THIS->from->type_field & ~BIT_STRING) &&    (array_fix_type_field(THIS->from) & ~BIT_STRING) ) -  SIMPLE_BAD_ARG_ERROR("replace", 1, +  SIMPLE_ARG_TYPE_ERROR("replace", 1,    "array(string)|mapping(string:string)");       if( (THIS->to->type_field & ~BIT_STRING) &&    (array_fix_type_field(THIS->to) & ~BIT_STRING) ) -  SIMPLE_BAD_ARG_ERROR("replace", 2, "array(string)|string"); +  SIMPLE_ARG_TYPE_ERROR("replace", 2, "array(string)|string");       compile_replace_many(&THIS->ctx, THIS->from, THIS->to, 1);    }
3577:    if (!del) return;       if (!to) { -  SIMPLE_BAD_ARG_ERROR("replace", 2, "string"); +  SIMPLE_ARG_TYPE_ERROR("replace", 2, "string");    }       if (del == to) {
4684:    rawtype tFunc(tObj tFunc(tMix tStr tType(tMix), tVoid), tVoid);    {    if (o != Pike_fp->current_object) { -  SIMPLE_BAD_ARG_ERROR("_serialize", 1, "this"); +  SIMPLE_ARG_TYPE_ERROR("_serialize", 1, "this");    }    low_serialize(SUBTYPEOF(Pike_sp[-args]), serializer, 0,    f_Serializable_cq__serialize_variable_fun_num);
4827:    rawtype tFunc(tObj tFunc(tFunc(tMix, tVoid) tStr tType(tMix), tVoid), tVoid);    {    if (o != Pike_fp->current_object) { -  SIMPLE_BAD_ARG_ERROR("_serialize", 1, "this"); +  SIMPLE_ARG_TYPE_ERROR("_serialize", 1, "this");    }    low_serialize(SUBTYPEOF(Pike_sp[-args]), deserializer, 1,    f_Serializable_cq__deserialize_variable_fun_num);
5375:    {    struct pike_list_node *node;    INT_TYPE n; -  if (TYPEOF(*key) != PIKE_T_INT) SIMPLE_BAD_ARG_ERROR("`[]", 1, "int"); +  if (TYPEOF(*key) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("`[]", 1, "int");       n = key->u.integer;    if (n < 0) n = -(n+1);