pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_types.c,v 1.332 2008/05/11 14:55:53 mast Exp $ + || $Id: pike_types.c,v 1.333 2008/05/11 22:40:11 mast Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:7440:    int size_shift = type_string[1] & 0x3;    struct pike_string *str;    INT32 bytes;    /* bit 0 & 1: size_shift    * bit 2 ==> little endian.    *    * The loops check the lsb first, since it's most likely to    * be non-zero.    */    switch(type_string[1]) { +  default: /* will not happen? */ + #ifdef PIKE_DEBUG +  Pike_fatal("unexpected case in make_pike_type (%d)\n", +  type_string[1]); + #endif    case 0: case 4:    bytes = strlen((char *)type_string+2);    break;    case 1:    for(bytes=0; ; bytes+=2)    if(!type_string[bytes+3] && !type_string[bytes+2])    break;    break;    case 5:    for(bytes=0; ; bytes+=2)
pike.git/src/pike_types.c:7465:    if(!type_string[bytes+5] && !type_string[bytes+4] &&    !type_string[bytes+3] && !type_string[bytes+2])    break;    break;    case 6:    for(bytes=0; ; bytes+=4)    if(!type_string[bytes+2] && !type_string[bytes+3] &&    !type_string[bytes+4] && !type_string[bytes+5])    break;    break; - #ifdef PIKE_DEBUG -  default: /* will not happen? */ -  bytes=0; -  Pike_fatal("unexpected case in make_pike_type (%d)\n", -  type_string[1]); - #endif +     }    str = begin_wide_shared_string(bytes>>size_shift, size_shift);    MEMCPY(str->str, type_string+2, bytes);    if (size_shift &&   #if (PIKE_BYTEORDER == 1234)    /* Little endian */    !(type_string[1] & 0x04)   #else /* PIKE_BYTEORDER != 1234 */    /* Big endian */    (type_string[1] & 0x04)
pike.git/src/pike_types.c:7546:      int pike_type_allow_premature_toss(struct pike_type *type)   {    again:   #if 0    fprintf(stderr, "pike_type_allow_premature_toss(): Type: %d\n",    type->type);   #endif /* 0 */    switch(type->type)    { +  default: + #ifdef PIKE_DEBUG +  Pike_fatal("pike_type_allow_premature_toss: Unknown type (code: %d)\n", +  type->type); +  /* NOT_REACHED */ +  return 0; + #endif    case T_NOT:    return !pike_type_allow_premature_toss(type->car);       case T_OBJECT:    case T_MIXED:    case T_FUNCTION:    case T_MANY:    return 0;       case PIKE_T_NAME:
pike.git/src/pike_types.c:7590:    goto again;       case T_PROGRAM:    case T_TYPE:    case T_INT:    case T_FLOAT:    case T_STRING:    case PIKE_T_ZERO:    case T_VOID:    return 1; - #ifdef PIKE_DEBUG -  default: -  Pike_fatal("pike_type_allow_premature_toss: Unknown type (code: %d)\n", -  type->type); -  /* NOT_REACHED */ -  return 0; - #endif +     }   }      static void low_type_to_string(struct pike_type *t)   {    recurse:    switch(t->type) {    case T_ARRAY:    case T_MULTISET:    case T_TYPE: