pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:12:   #include "svalue.h"   #include "mapping.h"   #include "array.h"   #include "multiset.h"   #include "dynamic_buffer.h"   #include "error.h"   #include "operators.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "fsort.h" + #include "threads.h"    - RCSID("$Id: encode.c,v 1.20 1998/04/24 00:32:08 hubbe Exp $"); + RCSID("$Id: encode.c,v 1.21 1998/04/27 22:33:17 hubbe Exp $");      #ifdef _AIX   #include <net/nh.h>   #endif      #ifdef HAVE_NETINET_IN_H   #include <netinet/in.h>   #endif      #include <math.h>
pike.git/src/encode.c:126:    case 0: addchar(num);    }   }         static void code_number(INT32 num, struct encode_data *data)   {    code_entry(num & 15, num >> 4, data);   }    + #ifdef _REENTRANT + static void do_enable_threads(void) + { +  if(!--threads_disabled) +  co_broadcast(&threads_disabled_change); + } + #endif +    static int encode_type(char *t, struct encode_data *data)   {    char *q=t;   one_more_type:    addchar(EXTRACT_UCHAR(t));    switch(EXTRACT_UCHAR(t++))    {    default:    fatal("error in type string.\n");    /*NOTREACHED*/
pike.git/src/encode.c:880:    error("Failed to decode program.\n");    break;       case 1:    {    int d;    SIZE_T size=0;    char *dat;    struct program *p;    + #ifdef _REENTRANT +  ONERROR err; +  threads_disabled++; +  SET_ONERROR(err, do_enable_threads, 0); + #endif +     p=low_allocate_program();    debug_malloc_touch(p);    tmp.type=T_PROGRAM;    tmp.u.program=p;    mapping_insert(data->decoded, & data->counter, &tmp);    data->counter.u.integer++;    p->refs--;       decode_number(p->flags,data);    p->flags &= ~(PROGRAM_FINISHED | PROGRAM_OPTIMIZED);
pike.git/src/encode.c:1038:    {    struct program *new_program_save=new_program;    new_program=p;    fsort((void *)p->identifier_index,    p->num_identifier_index,    sizeof(unsigned short),(fsortfun)program_function_index_compare);    new_program=new_program_save;    }    p->flags |= PROGRAM_FINISHED;    ref_push_program(p); +  + #ifdef _REENTRANT +  UNSET_ONERROR(err); +  if(!--threads_disabled) +  co_broadcast(&threads_disabled_change); + #endif    return;    }       default:    error("Cannot decode program encoding type %d\n",num);    }    break;       default:    error("Failed to restore string. (Illegal type)\n");