rem
stringlengths
0
83.5k
add
stringlengths
0
223k
context
stringlengths
10
471k
meta
stringlengths
120
236
if (DEBUGLEVEL>=6) fprintferr("GaloisConj: Fixed field %Z\n",P);
galoisgenfixedfield(GEN Tp, GEN Pmod, GEN V, GEN ip, struct galois_borne *gb, GEN Pg){ gpmem_t ltop=avma; GEN P, PL, Pden, PM, Pp, Pladicabs; GEN tau, PG; long g,gp; long x=varn(Tp); P=(GEN)V[2]; PL=(GEN)V[1]; gp=lg(Pmod)-1; Pp = FpX_red(P,ip); if (degpol(P)==2) { PG=cgetg(3,t_VEC); PG[1]=lgetg(2,t_VEC); PG[2]=lgetg(2,t_VECSMALL); mael(PG,1,1)=lgetg(3,t_VECSMALL); mael(PG,2,1)=2; mael3(PG,1,1,1)=2; mael3(PG,1,1,2)=1; tau=deg1pol(stoi(-1),negi((GEN)P[3]),x); tau = lift(gmul(tau,gmodulcp(gun,ip))); tau = FpX_FpXQ_compo((GEN) Pmod[gp], tau,Pp,ip); tau = FpX_gcd(Pp, tau,ip); tau = FpX_Fp_mul(tau,mpinvmod((GEN) tau[lgef(tau) - 1],ip),ip); for (g = 1; g <= gp; g++) if (gegal(tau, (GEN) Pmod[g])) break; if (g == lg(Pmod)) return NULL; Pg[1]=g; } else { struct galois_analysis Pga; struct galois_borne Pgb; long j; galoisanalysis(P, &Pga, 0, 0); if (Pga.deg == 0) return NULL; /* Avoid computing the discriminant */ Pgb.l = gb->l; Pden = galoisborne(P, NULL, &Pgb, Pga.ppp); Pladicabs=Pgb.ladicabs; if (Pgb.valabs > gb->valabs) { if (DEBUGLEVEL>=4) fprintferr("GaloisConj:increase prec of p-adic roots of %ld.\n" ,Pgb.valabs-gb->valabs); PL = rootpadicliftroots(P,PL,gb->l,Pgb.valabs); } PM = vandermondeinversemod(PL, P, Pden, Pgb.ladicabs); PG = galoisgen(P, PL, PM, Pden, &Pgb, &Pga); if (PG == gzero) return NULL; for (j = 1; j < lg(PG[1]); j++) { gpmem_t btop=avma; tau = permtopol(gmael(PG,1,j), PL, PM, Pden, Pladicabs, x); tau = lift(gmul(tau,gmodulcp(gun,ip))); tau = FpX_FpXQ_compo((GEN) Pmod[gp], tau,Pp,ip); tau = FpX_gcd(Pp, tau,ip); tau = FpX_Fp_mul(tau,mpinvmod((GEN) tau[lgef(tau) - 1],ip),ip); for (g = 1; g < lg(Pmod); g++) if (gegal(tau, (GEN) Pmod[g])) break; if (g == lg(Pmod)) return NULL; avma=btop; Pg[j]=g; } } return gerepilecopy(ltop,PG);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4e65706ae93bb2d05eb57b6b6749bcd874302c5e/galconj.c/buggy/src/basemath/galconj.c
k = serf_bucket_mem_alloc(bkt->allocator, end_key - ctx->line + 1); v = serf_bucket_mem_alloc(bkt->allocator, (ctx->line + ctx->line_used) - c); memcpy(k, ctx->line, end_key - ctx->line); k[end_key - ctx->line] = '\0'; memcpy(v, c, (ctx->line + ctx->line_used) - c); v[(ctx->line + ctx->line_used) - c] = '\0';
k = serf_bstrmemdup(bkt->allocator, ctx->line, end_key - ctx->line); v = serf_bstrmemdup(bkt->allocator, c, ctx->line + ctx->line_used - c);
static apr_status_t run_machine(serf_bucket_t *bkt, response_context_t *ctx){ apr_status_t status; switch (ctx->state) { case STATE_STATUS_LINE: status = fetch_line(ctx, ctx->stream); if (!status) { ctx->state = STATE_HEADERS; } break; case STATE_HEADERS: do { status = fetch_line(ctx, ctx->stream); if (status) { return status; } if (ctx->lstate == LINE_READY && ctx->line_used) { const char *end_key, *c; char *k, *v; end_key = c = memchr(ctx->line, ':', ctx->line_used); if (!c) { /* Bad headers? */ return APR_EGENERAL; } /* Skip over initial : and spaces. */ while (apr_isspace(*++c)); k = serf_bucket_mem_alloc(bkt->allocator, end_key - ctx->line + 1); v = serf_bucket_mem_alloc(bkt->allocator, (ctx->line + ctx->line_used) - c); memcpy(k, ctx->line, end_key - ctx->line); k[end_key - ctx->line] = '\0'; memcpy(v, c, (ctx->line + ctx->line_used) - c); v[(ctx->line + ctx->line_used) - c] = '\0'; serf_bucket_set_metadata(bkt, SERF_RESPONSE_HEADERS, k, v); } } while (!status && ctx->line_used); if (!status) { const void *v; /* Are we C-L, chunked, or conn close? */ serf_bucket_get_metadata(bkt, SERF_RESPONSE_HEADERS, "Content-Length", &v); if (v) { const char *cl = v; ctx->chunked = 0; ctx->body_left = apr_strtoi64(v, NULL, 10); if (errno == ERANGE) { return errno; } } ctx->state = STATE_BODY; } break; case STATE_BODY: /* Don't do anything. */ break; default: abort(); } return status;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/c88ac5bbf7089fbf6690293c86593aaffc529c9c/response_buckets.c/buggy/buckets/response_buckets.c
if (typ(perm) != t_VECSMALL) err(typeer, "galoispermtopol"); return permtopol(perm, (GEN) gal[3], (GEN) gal[4], (GEN) gal[5], varn((GEN) gal[1]));
switch (t) { case t_VECSMALL: return permtopol(perm, (GEN) gal[3], (GEN) gal[4], (GEN) gal[5], varn((GEN) gal[1])); case t_VEC: case t_COL: case t_MAT: v = cgetg(lg(perm), t); for (i = 1; i < lg(v); i++) v[i] = (long) galoispermtopol(gal, (GEN) perm[i]); return v; } err(typeer, "galoispermtopol"); return NULL; /* not reached */
galoispermtopol(GEN gal, GEN perm){ gal = checkgal(gal); if (typ(perm) != t_VECSMALL) err(typeer, "galoispermtopol"); return permtopol(perm, (GEN) gal[3], (GEN) gal[4], (GEN) gal[5], varn((GEN) gal[1]));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/f7acb57c6f4cb0fa13ddaa87f2e19f9dc614b76f/galconj.c/buggy/src/basemath/galconj.c
GEN B, norm, u;
GEN B, norm, u, up;
LLL_check_progress(GEN Bnorm, GEN m, long r, long C, GEN *ML, long id, long *ti_LLL){ GEN B, norm, u; long i, s, R; if (DEBUGLEVEL>2) (void)gentimer(id); m = lllint_ip(m, 4); u = lllint_i(m, 1000, 0, NULL, NULL, &B); if (DEBUGLEVEL>2) *ti_LLL += gentimer(id); norm = GS_norms(B, DEFAULTPREC); for (R=lg(m)-1; R > 0; R--) if (cmprr((GEN)norm[R], Bnorm) < 0) break; if (R > r) return R; /* no progress */ if (R <= 1) { if (R == 0) err(bugparier,"LLL_cmbf [no factor]"); return R; } setlg(u, R+1); for (i=1; i<=R; i++) setlg(u[i], r+1); if (C != 1) u = gdivexact(u, stoi(C)); s = R; u = image(u); R = lg(u)-1; if (DEBUGLEVEL>2 && R < s) fprintferr("LLL_cmbf: free rank decrease = %ld\n", R - s); *ML = gmul(*ML, u); return R;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6fed8a2c09101b005029af4fa4af78044bbc923f/polarit2.c/buggy/src/basemath/polarit2.c
s = R; u = image(u); R = lg(u)-1; if (DEBUGLEVEL>2 && R < s) fprintferr("LLL_cmbf: free rank decrease = %ld\n", R - s);
up = FpM_image(u, stoi(27449)); /* inexpensive test */ if (lg(up) != lg(u)) { s = R; u = image(u); R = lg(u)-1; if (DEBUGLEVEL>2 && R < s) fprintferr("LLL_cmbf: free rank decrease = %ld\n", R - s); }
LLL_check_progress(GEN Bnorm, GEN m, long r, long C, GEN *ML, long id, long *ti_LLL){ GEN B, norm, u; long i, s, R; if (DEBUGLEVEL>2) (void)gentimer(id); m = lllint_ip(m, 4); u = lllint_i(m, 1000, 0, NULL, NULL, &B); if (DEBUGLEVEL>2) *ti_LLL += gentimer(id); norm = GS_norms(B, DEFAULTPREC); for (R=lg(m)-1; R > 0; R--) if (cmprr((GEN)norm[R], Bnorm) < 0) break; if (R > r) return R; /* no progress */ if (R <= 1) { if (R == 0) err(bugparier,"LLL_cmbf [no factor]"); return R; } setlg(u, R+1); for (i=1; i<=R; i++) setlg(u[i], r+1); if (C != 1) u = gdivexact(u, stoi(C)); s = R; u = image(u); R = lg(u)-1; if (DEBUGLEVEL>2 && R < s) fprintferr("LLL_cmbf: free rank decrease = %ld\n", R - s); *ML = gmul(*ML, u); return R;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6fed8a2c09101b005029af4fa4af78044bbc923f/polarit2.c/buggy/src/basemath/polarit2.c
if (lx==1) { pariputs("[;]\n"); return; } pariputc('\n'); l=lg(g[1]);
if (lx==1 || lg(g[1]) == 1) { pariputs("[;]\n"); return; } l = lg(g[1]); pariputc('\n');
sori(GEN g, pariout_t *T){ long tg=typ(g), i,j,r,l,close_paren; GEN a,b; const char *v; char buf[32]; if (tg == t_INT) { wr_int(T,g,1); return; } if (tg != t_MAT && tg != t_COL) T->fieldw = 0; switch (tg) { case t_REAL: wr_real(T,g,1); return; case t_STR: quote_string(GSTR(g)); return; case t_LIST: pariputs("List("); l = lgeflist(g); for (i=2; i<l; i++) { sori((GEN)g[i], T); if (i < l-1) pariputs(", "); } pariputs(")\n"); return; } close_paren = 0; if (!is_graphicvec_t(tg)) { if (tg == t_FRAC && gsigne(g) < 0) pariputc('-'); pariputc('('); close_paren = 1; } switch(tg) { case t_INTMOD: case t_POLMOD: a = (GEN)g[2]; b = (GEN)g[1]; if (tg == t_INTMOD && signe(a) < 0) a = addii(a,b); sori(a,T); pariputs(" mod "); sori(b,T); break; case t_FRAC: a=(GEN)g[1]; wr_int(T,a,0); pariputs(" /"); b=(GEN)g[2]; wr_int(T,b,0); break; case t_COMPLEX: case t_QUAD: r = (tg==t_QUAD); a = (GEN)g[r+1]; b = (GEN)g[r+2]; v = r? "w": "I"; if (isnull(a)) { sor_lead_monome(T,b,v,1); break; } sori(a,T); if (!isnull(b)) sor_monome(T,b,v,1); break; case t_PADIC: { GEN p = (GEN)g[2]; char *ev; i = valp(g); l = precp(g)+i; g = (GEN)g[4]; ev = GENtostr(p); for (; i<l; i++) { g = dvmdii(g,p,&a); if (signe(a)) { if (!i || !is_pm1(a)) { wr_int(T,a,1); pariputc(i? '*': ' '); } if (i) { padic_nome(ev,i); pariputc(' '); } pariputs("+ "); } } pariputs("O("); if (!i) pariputs(" 1)"); else padic_nome(ev,i); pariputc(')'); free(ev); break; } case t_POL: if (!signe(g)) { pariputc('0'); break; } v = get_var(ordvar[varn(g)],buf); i = degpol(g); g += 2; while (isnull((GEN)g[i])) i--; sor_lead_monome(T,(GEN)g[i],v,i); while (i--) { a = (GEN)g[i]; if (!isnull_for_pol(a)) sor_monome(T,a,v,i); } break; case t_SER: v = get_var(ordvar[varn(g)],buf); i = valp(g); if (signe(g)) { /* hack: we want g[i] = coeff of degree i. */ l = i + lg(g)-2; g += (2-i); sor_lead_monome(T,(GEN)g[i],v,i); while (++i < l) { a = (GEN)g[i]; if (!isnull_for_pol(a)) sor_monome(T,a,v,i); } pariputs(" + "); } pariputs("O("); if (!i) pariputs(" 1)"); else monome(v,i); pariputc(')'); break; case t_RFRAC: sori((GEN)g[1],T); pariputs(" / "); sori((GEN)g[2],T); break; case t_QFR: case t_QFI: pariputc('{'); sori((GEN)g[1],T); pariputs(", "); sori((GEN)g[2],T); pariputs(", "); sori((GEN)g[3],T); if (tg == t_QFR) { pariputs(", "); sori((GEN)g[4],T); } pariputs("}\n"); break; case t_VEC: pariputc('['); for (i=1; i<lg(g); i++) { sori((GEN)g[i],T); if (i<lg(g)-1) pariputs(", "); } pariputc(']'); break; case t_VECSMALL: wr_vecsmall(T,g); break; case t_COL: if (lg(g)==1) { pariputs("[]\n"); return; } pariputc('\n'); for (i=1; i<lg(g); i++) { pariputc('['); sori((GEN)g[i],T); pariputs("]\n"); } break; case t_MAT: { void (*print)(GEN, pariout_t *); long lx = lg(g); if (lx==1) { pariputs("[;]\n"); return; } pariputc('\n'); l=lg(g[1]); print = (typ(g[1]) == t_VECSMALL)? sors: sori; for (i=1; i<l; i++) { pariputc('['); for (j=1; j<lx; j++) { print(gcoeff(g,i,j),T); if (j<lx-1) pariputc(' '); } pariputs("]\n"); if (i<l-1) pariputc('\n'); } break; } default: sorstring(VOIR_STRING2,*g); } if (close_paren) pariputc(')');}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/fbd2a87f0e943d3486e70335291cba0ff7e04bb0/es.c/buggy/src/language/es.c
if (phase == PHASE_DEAD)
if (pppd_phase == PHASE_DEAD)
link_terminated(unit) int unit;{ if (phase == PHASE_DEAD) return; if (pap_logout_hook) { pap_logout_hook(); } new_phase(PHASE_DEAD); notice("Connection terminated.");}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/auth.c/buggy/c/src/libnetworking/pppd/auth.c
printf (" Discarded:%-8lu\n", (unsigned long)m860.scc1p.un.ethernet.disfc);
printf (" Discarded:%-8lu\n", (unsigned long)m8xx.scc1p.un.ethernet.disfc);
enet_stats (struct m860_enet_struct *sc){ printf (" Rx Interrupts:%-8lu", sc->rxInterrupts); printf (" Not First:%-8lu", sc->rxNotFirst); printf (" Not Last:%-8lu\n", sc->rxNotLast); printf (" Giant:%-8lu", sc->rxGiant); printf (" Runt:%-8lu", sc->rxRunt); printf (" Non-octet:%-8lu\n", sc->rxNonOctet); printf (" Bad CRC:%-8lu", sc->rxBadCRC); printf (" Overrun:%-8lu", sc->rxOverrun); printf (" Collision:%-8lu\n", sc->rxCollision); printf (" Discarded:%-8lu\n", (unsigned long)m860.scc1p.un.ethernet.disfc); printf (" Tx Interrupts:%-8lu", sc->txInterrupts); printf (" Deferred:%-8lu", sc->txDeferred); printf (" Missed Hearbeat:%-8lu\n", sc->txHeartbeat); printf (" No Carrier:%-8lu", sc->txLostCarrier); printf ("Retransmit Limit:%-8lu", sc->txRetryLimit); printf (" Late Collision:%-8lu\n", sc->txLateCollision); printf (" Underrun:%-8lu", sc->txUnderrun); printf (" Raw output wait:%-8lu\n", sc->txRawWait);}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52/network.c/clean/c/src/lib/libbsp/powerpc/eth_comm/network/network.c
Objects_Name name,
rtems_name name,
rtems_status_code rtems_partition_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 buffer_size, rtems_attribute attribute_set, Objects_Id *id){ register Partition_Control *the_partition; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( length == 0 || buffer_size == 0 || length < buffer_size || !_Partition_Is_buffer_size_aligned( buffer_size ) ) return ( RTEMS_INVALID_SIZE ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); if ( _Attributes_Is_global( attribute_set ) && !_Configuration_Is_multiprocessing() ) return( RTEMS_MP_NOT_CONFIGURED ); _Thread_Disable_dispatch(); /* prevents deletion */ the_partition = _Partition_Allocate(); if ( !the_partition ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } if ( _Attributes_Is_global( attribute_set ) && !( _Objects_MP_Open( &_Partition_Information, name, the_partition->Object.id, FALSE ) ) ) { _Partition_Free( the_partition ); _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_partition->starting_address = starting_address; the_partition->length = length; the_partition->buffer_size = buffer_size; the_partition->attribute_set = attribute_set; the_partition->number_of_used_blocks = 0; _Chain_Initialize( &the_partition->Memory, starting_address, length / buffer_size, buffer_size ); _Objects_Open( &_Partition_Information, &the_partition->Object, name ); *id = the_partition->Object.id; if ( _Attributes_Is_global( attribute_set ) ) _Partition_MP_Send_process_packet( PARTITION_MP_ANNOUNCE_CREATE, the_partition->Object.id, name, 0 /* Not used */ ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/part.c/buggy/c/src/exec/rtems/src/part.c
if ( !_Objects_Is_name_valid( name ) )
if ( !rtems_is_name_valid( name ) )
rtems_status_code rtems_partition_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 buffer_size, rtems_attribute attribute_set, Objects_Id *id){ register Partition_Control *the_partition; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( length == 0 || buffer_size == 0 || length < buffer_size || !_Partition_Is_buffer_size_aligned( buffer_size ) ) return ( RTEMS_INVALID_SIZE ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); if ( _Attributes_Is_global( attribute_set ) && !_Configuration_Is_multiprocessing() ) return( RTEMS_MP_NOT_CONFIGURED ); _Thread_Disable_dispatch(); /* prevents deletion */ the_partition = _Partition_Allocate(); if ( !the_partition ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } if ( _Attributes_Is_global( attribute_set ) && !( _Objects_MP_Open( &_Partition_Information, name, the_partition->Object.id, FALSE ) ) ) { _Partition_Free( the_partition ); _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_partition->starting_address = starting_address; the_partition->length = length; the_partition->buffer_size = buffer_size; the_partition->attribute_set = attribute_set; the_partition->number_of_used_blocks = 0; _Chain_Initialize( &the_partition->Memory, starting_address, length / buffer_size, buffer_size ); _Objects_Open( &_Partition_Information, &the_partition->Object, name ); *id = the_partition->Object.id; if ( _Attributes_Is_global( attribute_set ) ) _Partition_MP_Send_process_packet( PARTITION_MP_ANNOUNCE_CREATE, the_partition->Object.id, name, 0 /* Not used */ ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/part.c/buggy/c/src/exec/rtems/src/part.c
_Objects_Open( &_Partition_Information, &the_partition->Object, name );
_Objects_Open( &_Partition_Information, &the_partition->Object, &name );
rtems_status_code rtems_partition_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 buffer_size, rtems_attribute attribute_set, Objects_Id *id){ register Partition_Control *the_partition; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( length == 0 || buffer_size == 0 || length < buffer_size || !_Partition_Is_buffer_size_aligned( buffer_size ) ) return ( RTEMS_INVALID_SIZE ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); if ( _Attributes_Is_global( attribute_set ) && !_Configuration_Is_multiprocessing() ) return( RTEMS_MP_NOT_CONFIGURED ); _Thread_Disable_dispatch(); /* prevents deletion */ the_partition = _Partition_Allocate(); if ( !the_partition ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } if ( _Attributes_Is_global( attribute_set ) && !( _Objects_MP_Open( &_Partition_Information, name, the_partition->Object.id, FALSE ) ) ) { _Partition_Free( the_partition ); _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_partition->starting_address = starting_address; the_partition->length = length; the_partition->buffer_size = buffer_size; the_partition->attribute_set = attribute_set; the_partition->number_of_used_blocks = 0; _Chain_Initialize( &the_partition->Memory, starting_address, length / buffer_size, buffer_size ); _Objects_Open( &_Partition_Information, &the_partition->Object, name ); *id = the_partition->Object.id; if ( _Attributes_Is_global( attribute_set ) ) _Partition_MP_Send_process_packet( PARTITION_MP_ANNOUNCE_CREATE, the_partition->Object.id, name, 0 /* Not used */ ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/part.c/buggy/c/src/exec/rtems/src/part.c
Objects_Name name,
rtems_name name,
rtems_status_code rtems_partition_ident( Objects_Name name, unsigned32 node, Objects_Id *id){ return( _Objects_Name_to_id( &_Partition_Information, name, node, id ) );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/part.c/buggy/c/src/exec/rtems/src/part.c
return( _Objects_Name_to_id( &_Partition_Information, name, node, id ) );
return _Objects_Name_to_id( &_Partition_Information, &name, node, id );
rtems_status_code rtems_partition_ident( Objects_Name name, unsigned32 node, Objects_Id *id){ return( _Objects_Name_to_id( &_Partition_Information, name, node, id ) );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/part.c/buggy/c/src/exec/rtems/src/part.c
#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support #else NULL #endif
_MESSAGE_QUEUE_CORE_MESSAGE_QUEUE_MP_SUPPORT
rtems_status_code _Message_queue_Submit( Objects_Id id, void *buffer, unsigned32 size, Message_queue_Submit_types submit_type){ register Message_queue_Control *the_message_queue; Objects_Locations location; CORE_message_queue_Status core_status; the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE:#if defined(RTEMS_MULTIPROCESSING) switch ( submit_type ) { case MESSAGE_QUEUE_SEND_REQUEST: return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_SEND_REQUEST, id, buffer, &size, 0, /* option_set */ MPCI_DEFAULT_TIMEOUT ); case MESSAGE_QUEUE_URGENT_REQUEST: return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_URGENT_REQUEST, id, buffer, &size, 0, /* option_set */ MPCI_DEFAULT_TIMEOUT ); } break;#endif case OBJECTS_ERROR: return RTEMS_INVALID_ID; case OBJECTS_LOCAL: switch ( submit_type ) { case MESSAGE_QUEUE_SEND_REQUEST: core_status = _CORE_message_queue_Send( &the_message_queue->message_queue, buffer, size, id,#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support#else NULL#endif ); break; case MESSAGE_QUEUE_URGENT_REQUEST: core_status = _CORE_message_queue_Urgent( &the_message_queue->message_queue, buffer, size, id,#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support#else NULL#endif ); break; default: core_status = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; return RTEMS_INTERNAL_ERROR; /* should never get here */ } _Thread_Enable_dispatch(); return _Message_queue_Translate_core_message_queue_return_code( core_status ); } return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f4a8ee1c55788aeb053ede7571b07906a9847a45/msg.c/clean/c/src/exec/rtems/src/msg.c
#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support #else NULL #endif
_MESSAGE_QUEUE_CORE_MESSAGE_QUEUE_MP_SUPPORT
rtems_status_code _Message_queue_Submit( Objects_Id id, void *buffer, unsigned32 size, Message_queue_Submit_types submit_type){ register Message_queue_Control *the_message_queue; Objects_Locations location; CORE_message_queue_Status core_status; the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE:#if defined(RTEMS_MULTIPROCESSING) switch ( submit_type ) { case MESSAGE_QUEUE_SEND_REQUEST: return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_SEND_REQUEST, id, buffer, &size, 0, /* option_set */ MPCI_DEFAULT_TIMEOUT ); case MESSAGE_QUEUE_URGENT_REQUEST: return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_URGENT_REQUEST, id, buffer, &size, 0, /* option_set */ MPCI_DEFAULT_TIMEOUT ); } break;#endif case OBJECTS_ERROR: return RTEMS_INVALID_ID; case OBJECTS_LOCAL: switch ( submit_type ) { case MESSAGE_QUEUE_SEND_REQUEST: core_status = _CORE_message_queue_Send( &the_message_queue->message_queue, buffer, size, id,#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support#else NULL#endif ); break; case MESSAGE_QUEUE_URGENT_REQUEST: core_status = _CORE_message_queue_Urgent( &the_message_queue->message_queue, buffer, size, id,#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support#else NULL#endif ); break; default: core_status = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL; return RTEMS_INTERNAL_ERROR; /* should never get here */ } _Thread_Enable_dispatch(); return _Message_queue_Translate_core_message_queue_return_code( core_status ); } return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f4a8ee1c55788aeb053ede7571b07906a9847a45/msg.c/clean/c/src/exec/rtems/src/msg.c
if ( the_thread_queue->sync ) {
if ( the_thread_queue->sync && the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) {
Thread_Control *_Thread_queue_Dequeue_priority( Thread_queue_Control *the_thread_queue){ unsigned32 index; ISR_Level level; Thread_Control *the_thread; Thread_Control *new_first_thread; Chain_Node *new_first_node; Chain_Node *new_second_node; Chain_Node *last_node; Chain_Node *next_node; Chain_Node *previous_node; _ISR_Disable( level ); for( index=0 ; index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ; index++ ) { if ( !_Chain_Is_empty( &the_thread_queue->Queues.Priority[ index ] ) ) { the_thread = (Thread_Control *) the_thread_queue->Queues.Priority[ index ].first; goto dequeue; } } if ( the_thread_queue->sync ) { the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; _ISR_Enable( level ); return _Thread_Executing; } _ISR_Enable( level ); return NULL;dequeue: new_first_node = the_thread->Wait.Block2n.first; new_first_thread = (Thread_Control *) new_first_node; next_node = the_thread->Object.Node.next; previous_node = the_thread->Object.Node.previous; if ( !_Chain_Is_empty( &the_thread->Wait.Block2n ) ) { last_node = the_thread->Wait.Block2n.last; new_second_node = new_first_node->next; previous_node->next = new_first_node; next_node->previous = new_first_node; new_first_node->next = next_node; new_first_node->previous = previous_node; if ( !_Chain_Has_only_one_node( &the_thread->Wait.Block2n ) ) { /* > two threads on 2-n */ new_second_node->previous = _Chain_Head( &new_first_thread->Wait.Block2n ); new_first_thread->Wait.Block2n.first = new_second_node; new_first_thread->Wait.Block2n.last = last_node; last_node->next = _Chain_Tail( &new_first_thread->Wait.Block2n ); } } else { previous_node->next = next_node; next_node->previous = previous_node; } if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { _ISR_Enable( level ); _Thread_Unblock( the_thread ); } else { _Watchdog_Deactivate( &the_thread->Timer ); _ISR_Enable( level ); (void) _Watchdog_Remove( &the_thread->Timer ); _Thread_Unblock( the_thread ); } if ( !_Objects_Is_local_id( the_thread->Object.id ) ) _Thread_MP_Free_proxy( the_thread ); return( the_thread );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f00a0522a48cbd903e830c4b24e1c9407ca1f6df/threadq.c/buggy/cpukit/score/src/threadq.c
the_thread_queue->sync = FALSE;
void _Thread_queue_Enqueue_priority( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, Watchdog_Interval timeout){ Priority_Control search_priority; Thread_Control *search_thread; ISR_Level level; Chain_Control *header; unsigned32 header_index; Chain_Node *the_node; Chain_Node *next_node; Chain_Node *previous_node; Chain_Node *search_node; Priority_Control priority; States_Control block_state; _Chain_Initialize_empty( &the_thread->Wait.Block2n ); priority = the_thread->current_priority; header_index = _Thread_queue_Header_number( priority ); header = &the_thread_queue->Queues.Priority[ header_index ]; block_state = the_thread_queue->state; if ( _Thread_queue_Is_reverse_search( priority ) ) goto restart_reverse_search;restart_forward_search: search_priority = PRIORITY_MINIMUM - 1; _ISR_Disable( level ); search_thread = (Thread_Control *) header->first; while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) { search_priority = search_thread->current_priority; if ( priority <= search_priority ) break;#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) search_thread = (Thread_Control *) search_thread->Object.Node.next; if ( _Chain_Is_tail( header, (Chain_Node *)search_thread ) ) break; search_priority = search_thread->current_priority; if ( priority <= search_priority ) break;#endif _ISR_Flash( level ); if ( !_States_Are_set( search_thread->current_state, block_state) ) { _ISR_Enable( level ); goto restart_forward_search; } search_thread = (Thread_Control *)search_thread->Object.Node.next; } if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) goto syncronize; the_thread_queue->sync = FALSE; if ( priority == search_priority ) goto equal_priority; search_node = (Chain_Node *) search_thread; previous_node = search_node->previous; the_node = (Chain_Node *) the_thread; the_node->next = search_node; the_node->previous = previous_node; previous_node->next = the_node; search_node->previous = the_node; _ISR_Enable( level ); return;restart_reverse_search: search_priority = PRIORITY_MAXIMUM + 1; _ISR_Disable( level ); search_thread = (Thread_Control *) header->last; while ( !_Chain_Is_head( header, (Chain_Node *)search_thread ) ) { search_priority = search_thread->current_priority; if ( priority >= search_priority ) break;#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) search_thread = (Thread_Control *) search_thread->Object.Node.previous; if ( _Chain_Is_head( header, (Chain_Node *)search_thread ) ) break; search_priority = search_thread->current_priority; if ( priority >= search_priority ) break;#endif _ISR_Flash( level ); if ( !_States_Are_set( search_thread->current_state, block_state) ) { _ISR_Enable( level ); goto restart_reverse_search; } search_thread = (Thread_Control *) search_thread->Object.Node.previous; } if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) goto syncronize; the_thread_queue->sync = FALSE; if ( priority == search_priority ) goto equal_priority; search_node = (Chain_Node *) search_thread; next_node = search_node->next; the_node = (Chain_Node *) the_thread; the_node->next = next_node; the_node->previous = search_node; search_node->next = the_node; next_node->previous = the_node; _ISR_Enable( level ); return;equal_priority: /* add at end of priority group */ search_node = _Chain_Tail( &search_thread->Wait.Block2n ); previous_node = search_node->previous; the_node = (Chain_Node *) the_thread; the_node->next = search_node; the_node->previous = previous_node; previous_node->next = the_node; search_node->previous = the_node; _ISR_Enable( level ); return;syncronize: switch ( the_thread_queue->sync_state ) { case THREAD_QUEUE_NOTHING_HAPPENED: /* * All of this was dealt with above. This should never happen. */ break; case THREAD_QUEUE_TIMEOUT: the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; _ISR_Enable( level ); break; case THREAD_QUEUE_SATISFIED: if ( _Watchdog_Is_active( &the_thread->Timer ) ) { _Watchdog_Deactivate( &the_thread->Timer ); _ISR_Enable( level ); (void) _Watchdog_Remove( &the_thread->Timer ); } else _ISR_Enable( level ); break; } /* * Global objects with thread queue's should not be operated on from an * ISR. But the sync code still must allow short timeouts to be processed * correctly. */ _Thread_Unblock( the_thread ); if ( !_Objects_Is_local_id( the_thread->Object.id ) ) _Thread_MP_Free_proxy( the_thread );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f00a0522a48cbd903e830c4b24e1c9407ca1f6df/threadq.c/buggy/cpukit/score/src/threadq.c
the_thread_queue->sync = FALSE;
void _Thread_queue_Enqueue_priority( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, Watchdog_Interval timeout){ Priority_Control search_priority; Thread_Control *search_thread; ISR_Level level; Chain_Control *header; unsigned32 header_index; Chain_Node *the_node; Chain_Node *next_node; Chain_Node *previous_node; Chain_Node *search_node; Priority_Control priority; States_Control block_state; _Chain_Initialize_empty( &the_thread->Wait.Block2n ); priority = the_thread->current_priority; header_index = _Thread_queue_Header_number( priority ); header = &the_thread_queue->Queues.Priority[ header_index ]; block_state = the_thread_queue->state; if ( _Thread_queue_Is_reverse_search( priority ) ) goto restart_reverse_search;restart_forward_search: search_priority = PRIORITY_MINIMUM - 1; _ISR_Disable( level ); search_thread = (Thread_Control *) header->first; while ( !_Chain_Is_tail( header, (Chain_Node *)search_thread ) ) { search_priority = search_thread->current_priority; if ( priority <= search_priority ) break;#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) search_thread = (Thread_Control *) search_thread->Object.Node.next; if ( _Chain_Is_tail( header, (Chain_Node *)search_thread ) ) break; search_priority = search_thread->current_priority; if ( priority <= search_priority ) break;#endif _ISR_Flash( level ); if ( !_States_Are_set( search_thread->current_state, block_state) ) { _ISR_Enable( level ); goto restart_forward_search; } search_thread = (Thread_Control *)search_thread->Object.Node.next; } if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) goto syncronize; the_thread_queue->sync = FALSE; if ( priority == search_priority ) goto equal_priority; search_node = (Chain_Node *) search_thread; previous_node = search_node->previous; the_node = (Chain_Node *) the_thread; the_node->next = search_node; the_node->previous = previous_node; previous_node->next = the_node; search_node->previous = the_node; _ISR_Enable( level ); return;restart_reverse_search: search_priority = PRIORITY_MAXIMUM + 1; _ISR_Disable( level ); search_thread = (Thread_Control *) header->last; while ( !_Chain_Is_head( header, (Chain_Node *)search_thread ) ) { search_priority = search_thread->current_priority; if ( priority >= search_priority ) break;#if ( CPU_UNROLL_ENQUEUE_PRIORITY == TRUE ) search_thread = (Thread_Control *) search_thread->Object.Node.previous; if ( _Chain_Is_head( header, (Chain_Node *)search_thread ) ) break; search_priority = search_thread->current_priority; if ( priority >= search_priority ) break;#endif _ISR_Flash( level ); if ( !_States_Are_set( search_thread->current_state, block_state) ) { _ISR_Enable( level ); goto restart_reverse_search; } search_thread = (Thread_Control *) search_thread->Object.Node.previous; } if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) goto syncronize; the_thread_queue->sync = FALSE; if ( priority == search_priority ) goto equal_priority; search_node = (Chain_Node *) search_thread; next_node = search_node->next; the_node = (Chain_Node *) the_thread; the_node->next = next_node; the_node->previous = search_node; search_node->next = the_node; next_node->previous = the_node; _ISR_Enable( level ); return;equal_priority: /* add at end of priority group */ search_node = _Chain_Tail( &search_thread->Wait.Block2n ); previous_node = search_node->previous; the_node = (Chain_Node *) the_thread; the_node->next = search_node; the_node->previous = previous_node; previous_node->next = the_node; search_node->previous = the_node; _ISR_Enable( level ); return;syncronize: switch ( the_thread_queue->sync_state ) { case THREAD_QUEUE_NOTHING_HAPPENED: /* * All of this was dealt with above. This should never happen. */ break; case THREAD_QUEUE_TIMEOUT: the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; _ISR_Enable( level ); break; case THREAD_QUEUE_SATISFIED: if ( _Watchdog_Is_active( &the_thread->Timer ) ) { _Watchdog_Deactivate( &the_thread->Timer ); _ISR_Enable( level ); (void) _Watchdog_Remove( &the_thread->Timer ); } else _ISR_Enable( level ); break; } /* * Global objects with thread queue's should not be operated on from an * ISR. But the sync code still must allow short timeouts to be processed * correctly. */ _Thread_Unblock( the_thread ); if ( !_Objects_Is_local_id( the_thread->Object.id ) ) _Thread_MP_Free_proxy( the_thread );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f00a0522a48cbd903e830c4b24e1c9407ca1f6df/threadq.c/buggy/cpukit/score/src/threadq.c
the_thread_queue->sync = FALSE;
void _Thread_queue_Enqueue_fifo ( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, Watchdog_Interval timeout){ ISR_Level level; _ISR_Disable( level ); switch ( the_thread_queue->sync_state ) { case THREAD_QUEUE_NOTHING_HAPPENED: the_thread_queue->sync = FALSE; _Chain_Append_unprotected( &the_thread_queue->Queues.Fifo, &the_thread->Object.Node ); _ISR_Enable( level ); return; case THREAD_QUEUE_TIMEOUT: the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; _ISR_Enable( level ); break; case THREAD_QUEUE_SATISFIED: if ( _Watchdog_Is_active( &the_thread->Timer ) ) { _Watchdog_Deactivate( &the_thread->Timer ); _ISR_Enable( level ); (void) _Watchdog_Remove( &the_thread->Timer ); } else _ISR_Enable( level ); break; } /* * Global objects with thread queue's should not be operated on from an * ISR. But the sync code still must allow short timeouts to be processed * correctly. */ _Thread_Unblock( the_thread ); if ( !_Objects_Is_local_id( the_thread->Object.id ) ) _Thread_MP_Free_proxy( the_thread );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f00a0522a48cbd903e830c4b24e1c9407ca1f6df/threadq.c/buggy/cpukit/score/src/threadq.c
} else if ( the_thread_queue->sync ) {
} else if ( the_thread_queue->sync && the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) {
Thread_Control *_Thread_queue_Dequeue_fifo( Thread_queue_Control *the_thread_queue){ ISR_Level level; Thread_Control *the_thread; _ISR_Disable( level ); if ( !_Chain_Is_empty( &the_thread_queue->Queues.Fifo ) ) { the_thread = (Thread_Control *) _Chain_Get_first_unprotected( &the_thread_queue->Queues.Fifo ); if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { _ISR_Enable( level ); _Thread_Unblock( the_thread ); } else { _Watchdog_Deactivate( &the_thread->Timer ); _ISR_Enable( level ); (void) _Watchdog_Remove( &the_thread->Timer ); _Thread_Unblock( the_thread ); } if ( !_Objects_Is_local_id( the_thread->Object.id ) ) _Thread_MP_Free_proxy( the_thread ); return the_thread; } else if ( the_thread_queue->sync ) { the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; _ISR_Enable( level ); return _Thread_Executing; } else { _ISR_Enable( level ); return NULL; }}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f00a0522a48cbd903e830c4b24e1c9407ca1f6df/threadq.c/buggy/cpukit/score/src/threadq.c
status = EXIT_CONNECT_TIME;
pppd_status = EXIT_CONNECT_TIME;
connect_time_expired(arg) void *arg;{ info("Connect time expired"); lcp_close(0, "Connect time expired"); /* Close connection */ status = EXIT_CONNECT_TIME;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/auth.c/clean/c/src/libnetworking/pppd/auth.c
status = EXIT_AUTH_TOPEER_FAILED;
pppd_status = EXIT_AUTH_TOPEER_FAILED;
auth_withpeer_fail(unit, protocol) int unit, protocol;{ if (passwd_from_file) BZERO(passwd, MAXSECRETLEN); /* * We've failed to authenticate ourselves to our peer. * Some servers keep sending CHAP challenges, but there * is no point in persisting without any way to get updated * authentication secrets. */ lcp_close(unit, "Failed to authenticate ourselves to peer"); status = EXIT_AUTH_TOPEER_FAILED;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/auth.c/clean/cpukit/pppd/auth.c
ctx->body = serf_bucket_limit_create(ctx->stream, length,
ctx->body = serf_bucket_limit_create(ctx->body, length,
static apr_status_t run_machine(serf_bucket_t *bkt, response_context_t *ctx){ apr_status_t status = APR_SUCCESS; /* initialize to avoid gcc warnings */ switch (ctx->state) { case STATE_STATUS_LINE: /* RFC 2616 says that CRLF is the only line ending, but we can easily * accept any kind of line ending. */ status = fetch_line(ctx, SERF_NEWLINE_ANY); if (SERF_BUCKET_READ_ERROR(status)) return status; if (ctx->linebuf.state == SERF_LINEBUF_READY) { /* The Status-Line is in the line buffer. Process it. */ status = parse_status_line(ctx, bkt->allocator); if (status) return status; /* Okay... move on to reading the headers. */ ctx->state = STATE_HEADERS; } break; case STATE_HEADERS: status = fetch_headers(bkt, ctx); if (SERF_BUCKET_READ_ERROR(status)) return status; /* If an empty line was read, then we hit the end of the headers. * Move on to the body. */ if (ctx->linebuf.state == SERF_LINEBUF_READY && !ctx->linebuf.used) { const void *v; /* Are we C-L, chunked, or conn close? */ v = serf_bucket_headers_get(ctx->headers, "Content-Length"); if (v) { apr_size_t length; length = apr_strtoi64(v, NULL, 10); if (errno == ERANGE) { return APR_FROM_OS_ERROR(ERANGE); } ctx->body = serf_bucket_limit_create(ctx->stream, length, bkt->allocator); } else { v = serf_bucket_headers_get(ctx->headers, "Transfer-Encoding"); /* Need to handle multiple transfer-encoding. */ if (v && strcasecmp("chunked", v) == 0) { ctx->chunked = 1; ctx->body = serf_bucket_dechunk_create(ctx->stream, bkt->allocator); } /* Connection: Close response. */ /* FIXME There is a problem that arises here due to bucket * ownership. If we were to get a Conn: Close with gzip * encoding, we'll get a double free and abort(). * * The reason is that the deflate bucket assumes that its * streams are of the same lifetime. However, the dechunk * and limit buckets assume that its streams are of * different lifetimes. This isn't quite right and needs * to be rethought. */ if (!ctx->body) { ctx->body = ctx->stream; } } v = serf_bucket_headers_get(ctx->headers, "Content-Encoding"); if (v) { /* Need to handle multiple content-encoding. */ if (v && strcasecmp("gzip", v) == 0) { ctx->body = serf_bucket_deflate_create(ctx->body, bkt->allocator); } } ctx->state = STATE_BODY; } break; case STATE_BODY: /* Don't do anything. */ break; case STATE_TRAILERS: status = fetch_headers(bkt, ctx); if (SERF_BUCKET_READ_ERROR(status)) return status; /* If an empty line was read, then we're done. */ if (ctx->linebuf.state == SERF_LINEBUF_READY && !ctx->linebuf.used) { ctx->state = STATE_DONE; return APR_EOF; } break; case STATE_DONE: return APR_EOF; default: abort(); } return status;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/c161a2e07956023692bfee04809ffa7069c8def2/response_buckets.c/buggy/buckets/response_buckets.c
ctx->body = serf_bucket_dechunk_create(ctx->stream,
ctx->body = serf_bucket_dechunk_create(ctx->body,
static apr_status_t run_machine(serf_bucket_t *bkt, response_context_t *ctx){ apr_status_t status = APR_SUCCESS; /* initialize to avoid gcc warnings */ switch (ctx->state) { case STATE_STATUS_LINE: /* RFC 2616 says that CRLF is the only line ending, but we can easily * accept any kind of line ending. */ status = fetch_line(ctx, SERF_NEWLINE_ANY); if (SERF_BUCKET_READ_ERROR(status)) return status; if (ctx->linebuf.state == SERF_LINEBUF_READY) { /* The Status-Line is in the line buffer. Process it. */ status = parse_status_line(ctx, bkt->allocator); if (status) return status; /* Okay... move on to reading the headers. */ ctx->state = STATE_HEADERS; } break; case STATE_HEADERS: status = fetch_headers(bkt, ctx); if (SERF_BUCKET_READ_ERROR(status)) return status; /* If an empty line was read, then we hit the end of the headers. * Move on to the body. */ if (ctx->linebuf.state == SERF_LINEBUF_READY && !ctx->linebuf.used) { const void *v; /* Are we C-L, chunked, or conn close? */ v = serf_bucket_headers_get(ctx->headers, "Content-Length"); if (v) { apr_size_t length; length = apr_strtoi64(v, NULL, 10); if (errno == ERANGE) { return APR_FROM_OS_ERROR(ERANGE); } ctx->body = serf_bucket_limit_create(ctx->stream, length, bkt->allocator); } else { v = serf_bucket_headers_get(ctx->headers, "Transfer-Encoding"); /* Need to handle multiple transfer-encoding. */ if (v && strcasecmp("chunked", v) == 0) { ctx->chunked = 1; ctx->body = serf_bucket_dechunk_create(ctx->stream, bkt->allocator); } /* Connection: Close response. */ /* FIXME There is a problem that arises here due to bucket * ownership. If we were to get a Conn: Close with gzip * encoding, we'll get a double free and abort(). * * The reason is that the deflate bucket assumes that its * streams are of the same lifetime. However, the dechunk * and limit buckets assume that its streams are of * different lifetimes. This isn't quite right and needs * to be rethought. */ if (!ctx->body) { ctx->body = ctx->stream; } } v = serf_bucket_headers_get(ctx->headers, "Content-Encoding"); if (v) { /* Need to handle multiple content-encoding. */ if (v && strcasecmp("gzip", v) == 0) { ctx->body = serf_bucket_deflate_create(ctx->body, bkt->allocator); } } ctx->state = STATE_BODY; } break; case STATE_BODY: /* Don't do anything. */ break; case STATE_TRAILERS: status = fetch_headers(bkt, ctx); if (SERF_BUCKET_READ_ERROR(status)) return status; /* If an empty line was read, then we're done. */ if (ctx->linebuf.state == SERF_LINEBUF_READY && !ctx->linebuf.used) { ctx->state = STATE_DONE; return APR_EOF; } break; case STATE_DONE: return APR_EOF; default: abort(); } return status;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/c161a2e07956023692bfee04809ffa7069c8def2/response_buckets.c/buggy/buckets/response_buckets.c
if (!ctx->body) { ctx->body = ctx->stream;
if (!ctx->chunked) { /*abort();*/
static apr_status_t run_machine(serf_bucket_t *bkt, response_context_t *ctx){ apr_status_t status = APR_SUCCESS; /* initialize to avoid gcc warnings */ switch (ctx->state) { case STATE_STATUS_LINE: /* RFC 2616 says that CRLF is the only line ending, but we can easily * accept any kind of line ending. */ status = fetch_line(ctx, SERF_NEWLINE_ANY); if (SERF_BUCKET_READ_ERROR(status)) return status; if (ctx->linebuf.state == SERF_LINEBUF_READY) { /* The Status-Line is in the line buffer. Process it. */ status = parse_status_line(ctx, bkt->allocator); if (status) return status; /* Okay... move on to reading the headers. */ ctx->state = STATE_HEADERS; } break; case STATE_HEADERS: status = fetch_headers(bkt, ctx); if (SERF_BUCKET_READ_ERROR(status)) return status; /* If an empty line was read, then we hit the end of the headers. * Move on to the body. */ if (ctx->linebuf.state == SERF_LINEBUF_READY && !ctx->linebuf.used) { const void *v; /* Are we C-L, chunked, or conn close? */ v = serf_bucket_headers_get(ctx->headers, "Content-Length"); if (v) { apr_size_t length; length = apr_strtoi64(v, NULL, 10); if (errno == ERANGE) { return APR_FROM_OS_ERROR(ERANGE); } ctx->body = serf_bucket_limit_create(ctx->stream, length, bkt->allocator); } else { v = serf_bucket_headers_get(ctx->headers, "Transfer-Encoding"); /* Need to handle multiple transfer-encoding. */ if (v && strcasecmp("chunked", v) == 0) { ctx->chunked = 1; ctx->body = serf_bucket_dechunk_create(ctx->stream, bkt->allocator); } /* Connection: Close response. */ /* FIXME There is a problem that arises here due to bucket * ownership. If we were to get a Conn: Close with gzip * encoding, we'll get a double free and abort(). * * The reason is that the deflate bucket assumes that its * streams are of the same lifetime. However, the dechunk * and limit buckets assume that its streams are of * different lifetimes. This isn't quite right and needs * to be rethought. */ if (!ctx->body) { ctx->body = ctx->stream; } } v = serf_bucket_headers_get(ctx->headers, "Content-Encoding"); if (v) { /* Need to handle multiple content-encoding. */ if (v && strcasecmp("gzip", v) == 0) { ctx->body = serf_bucket_deflate_create(ctx->body, bkt->allocator); } } ctx->state = STATE_BODY; } break; case STATE_BODY: /* Don't do anything. */ break; case STATE_TRAILERS: status = fetch_headers(bkt, ctx); if (SERF_BUCKET_READ_ERROR(status)) return status; /* If an empty line was read, then we're done. */ if (ctx->linebuf.state == SERF_LINEBUF_READY && !ctx->linebuf.used) { ctx->state = STATE_DONE; return APR_EOF; } break; case STATE_DONE: return APR_EOF; default: abort(); } return status;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/c161a2e07956023692bfee04809ffa7069c8def2/response_buckets.c/buggy/buckets/response_buckets.c
rtems_device_driver status ;
rtems_device_driver status;
rtems_device_driver sh_sci_initialize( rtems_device_major_number major, rtems_device_minor_number minor, void *arg ){ rtems_device_driver status ; rtems_device_minor_number i; rtems_driver_name_t *driver = NULL; /* * register all possible devices. * the initialization of the hardware is done by sci_open * * One of devices could be previously registered by console * initialization therefore we check it everytime */ for ( i = 0 ; i < SCI_MINOR_DEVICES ; i++ ) { status = rtems_io_lookup_name( sci_device[i].name, &driver); if( status != RTEMS_SUCCESSFUL ) { /* OK. We assume it is not registered yet. */ status = rtems_io_register_name( sci_device[i].name, major, sci_device[i].minor ); if (status != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(status); } } /* non-default hardware setup occurs in sh_sci_open() */ return RTEMS_SUCCESSFUL;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/b4f92a9ee26980d7b8ebcccc2ed87144dd2c5a32/sci.c/clean/c/src/lib/libcpu/sh/sh7045/sci/sci.c
rtems_driver_name_t *driver = NULL;
rtems_driver_name_t driver;
rtems_device_driver sh_sci_initialize( rtems_device_major_number major, rtems_device_minor_number minor, void *arg ){ rtems_device_driver status ; rtems_device_minor_number i; rtems_driver_name_t *driver = NULL; /* * register all possible devices. * the initialization of the hardware is done by sci_open * * One of devices could be previously registered by console * initialization therefore we check it everytime */ for ( i = 0 ; i < SCI_MINOR_DEVICES ; i++ ) { status = rtems_io_lookup_name( sci_device[i].name, &driver); if( status != RTEMS_SUCCESSFUL ) { /* OK. We assume it is not registered yet. */ status = rtems_io_register_name( sci_device[i].name, major, sci_device[i].minor ); if (status != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(status); } } /* non-default hardware setup occurs in sh_sci_open() */ return RTEMS_SUCCESSFUL;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/b4f92a9ee26980d7b8ebcccc2ed87144dd2c5a32/sci.c/clean/c/src/lib/libcpu/sh/sh7045/sci/sci.c
if (!under_emacs && !ioctl(0, TIOCGWINSZ, &s)) return s.ws_row;
if (!under_emacs && !under_texmacs && !ioctl(0, TIOCGWINSZ, &s)) return s.ws_row;
term_height_intern(){#ifdef HAS_TIOCGWINSZ { struct winsize s; if (!under_emacs && !ioctl(0, TIOCGWINSZ, &s)) return s.ws_row; }#endif#ifdef UNIX { char *str; if ((str = getenv("LINES"))) return atoi(str); }#endif#ifdef __EMX__ { int scrsize[2]; _scrsize(scrsize); return scrsize[1]; }#endif return 0;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4c6ac6a72a1cc066dc2f11d42bd5c5b72a9d8e5d/es.c/buggy/src/language/es.c
unsigned32 tmr_freq;
uint32_t tmr_freq;
void Timer_initialize( void ){ unsigned32 tmr_freq; /* since we are using timer_clock2, divide mck by 8 */ tmr_freq = at91rm9200_get_mck() / 8; TC_TC0_REG(TC_CMR) = TC_CMR_TCCLKS(1); /* timer_clock2 */ TC_TC0_REG(TC_CCR) = (TC_CCR_CLKEN /* enable the counter */ | TC_CCR_SWTRG); /* start it up */ /* tick time in nanoseconds */ tick_time = 1000000000/tmr_freq;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/15ebe58b4ead4a088120590b80700bc152416cb9/timer.c/buggy/c/src/lib/libcpu/arm/at91rm9200/timer/timer.c
long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N;
long j, k, lva = lg(va)-1, a, N = lg(cff)-1;
twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff){ long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N; pari_sp av, lim; GEN x = polx[0], y = polx[fetch_user_var("y")], eta, one, mon, den; GEN cyc, psm, invden, rep, ser; cyc = gdiv(gsubgs(gpowgs(y, c), 1), gsubgs(y, 1)); psm = polsym(cyc, degpol(cyc) - 1); eta = gmodulcp(y, cyc); one = gmodulsg(1, q); /* Mod(1, q); */ mon = gaddsg(1, x); den = gsubsg(1, gmul(gpowgs(gmul(one,eta), f), gpowgs(gmul(one,mon), f))); /* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5)); av = avma; lim = stack_lim(av, 1); invden = ginv(den); rep = zerovec(lva); /* a = 1 is always the first element of va */ ser = gmul(gmul(eta, mon), invden); ser = lift_intern(lift_intern(ser)); /* t_SER of ZY */ /* ser is a unit, convert to POL */ ser[0] = evaltyp(t_POL)| evallg(lg(ser)); ser[1] = evalsigne(1)| evalvarn(0); a = 1; for (j = 1; j <= lva; j++) { GEN p1 = gzero; if (DEBUGLEVEL > 2 && !(j%50)) fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva); for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p2 = quicktrace(polcoeff_i(ser,k,0), psm); p1 = gerepileupto(av2, addii(p1, mulii((GEN)cff[k], p2))); } rep[j] = lmodii(p1, q); if (j < lva) { long e = va[j+1] - a, i; GEN z = eta; for (i = 1; i <= e; i++) /* assume e small */ { ser = addmulXn(ser, ser, 1); /* ser *= 1+x */ setlg(ser, lg(ser)-1); /* truncate highest degree term */ } if (e > 1) z = gpowgs(z, e); z = lift_intern(z); if (!degpol(z)) { z = (GEN)z[2]; /* +/- 1 */ if (signe(z) < 0) ser = gneg(ser); ser = FpXX_red(ser, q); } else { ser = gmul(z, ser); for (i=2; i<lg(ser); i++) ser[i] = (long)FpX_rem((GEN)ser[i], cyc, q); } a = va[j+1]; } if (low_stack(lim, stack_lim(av, 1))) { if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva); gerepileall(av, 2, &rep, &ser); } } return rep;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/75bbe23ab8ce138cca18cb88feeca14172e80520/trans3.c/clean/src/basemath/trans3.c
/* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5));
den = gadd(den, zeroser(0, N+1));
twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff){ long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N; pari_sp av, lim; GEN x = polx[0], y = polx[fetch_user_var("y")], eta, one, mon, den; GEN cyc, psm, invden, rep, ser; cyc = gdiv(gsubgs(gpowgs(y, c), 1), gsubgs(y, 1)); psm = polsym(cyc, degpol(cyc) - 1); eta = gmodulcp(y, cyc); one = gmodulsg(1, q); /* Mod(1, q); */ mon = gaddsg(1, x); den = gsubsg(1, gmul(gpowgs(gmul(one,eta), f), gpowgs(gmul(one,mon), f))); /* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5)); av = avma; lim = stack_lim(av, 1); invden = ginv(den); rep = zerovec(lva); /* a = 1 is always the first element of va */ ser = gmul(gmul(eta, mon), invden); ser = lift_intern(lift_intern(ser)); /* t_SER of ZY */ /* ser is a unit, convert to POL */ ser[0] = evaltyp(t_POL)| evallg(lg(ser)); ser[1] = evalsigne(1)| evalvarn(0); a = 1; for (j = 1; j <= lva; j++) { GEN p1 = gzero; if (DEBUGLEVEL > 2 && !(j%50)) fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva); for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p2 = quicktrace(polcoeff_i(ser,k,0), psm); p1 = gerepileupto(av2, addii(p1, mulii((GEN)cff[k], p2))); } rep[j] = lmodii(p1, q); if (j < lva) { long e = va[j+1] - a, i; GEN z = eta; for (i = 1; i <= e; i++) /* assume e small */ { ser = addmulXn(ser, ser, 1); /* ser *= 1+x */ setlg(ser, lg(ser)-1); /* truncate highest degree term */ } if (e > 1) z = gpowgs(z, e); z = lift_intern(z); if (!degpol(z)) { z = (GEN)z[2]; /* +/- 1 */ if (signe(z) < 0) ser = gneg(ser); ser = FpXX_red(ser, q); } else { ser = gmul(z, ser); for (i=2; i<lg(ser); i++) ser[i] = (long)FpX_rem((GEN)ser[i], cyc, q); } a = va[j+1]; } if (low_stack(lim, stack_lim(av, 1))) { if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva); gerepileall(av, 2, &rep, &ser); } } return rep;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/75bbe23ab8ce138cca18cb88feeca14172e80520/trans3.c/clean/src/basemath/trans3.c
fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva);
fprintferr(" twistpartialzeta: %ld\%\n", 100*j/lva);
twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff){ long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N; pari_sp av, lim; GEN x = polx[0], y = polx[fetch_user_var("y")], eta, one, mon, den; GEN cyc, psm, invden, rep, ser; cyc = gdiv(gsubgs(gpowgs(y, c), 1), gsubgs(y, 1)); psm = polsym(cyc, degpol(cyc) - 1); eta = gmodulcp(y, cyc); one = gmodulsg(1, q); /* Mod(1, q); */ mon = gaddsg(1, x); den = gsubsg(1, gmul(gpowgs(gmul(one,eta), f), gpowgs(gmul(one,mon), f))); /* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5)); av = avma; lim = stack_lim(av, 1); invden = ginv(den); rep = zerovec(lva); /* a = 1 is always the first element of va */ ser = gmul(gmul(eta, mon), invden); ser = lift_intern(lift_intern(ser)); /* t_SER of ZY */ /* ser is a unit, convert to POL */ ser[0] = evaltyp(t_POL)| evallg(lg(ser)); ser[1] = evalsigne(1)| evalvarn(0); a = 1; for (j = 1; j <= lva; j++) { GEN p1 = gzero; if (DEBUGLEVEL > 2 && !(j%50)) fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva); for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p2 = quicktrace(polcoeff_i(ser,k,0), psm); p1 = gerepileupto(av2, addii(p1, mulii((GEN)cff[k], p2))); } rep[j] = lmodii(p1, q); if (j < lva) { long e = va[j+1] - a, i; GEN z = eta; for (i = 1; i <= e; i++) /* assume e small */ { ser = addmulXn(ser, ser, 1); /* ser *= 1+x */ setlg(ser, lg(ser)-1); /* truncate highest degree term */ } if (e > 1) z = gpowgs(z, e); z = lift_intern(z); if (!degpol(z)) { z = (GEN)z[2]; /* +/- 1 */ if (signe(z) < 0) ser = gneg(ser); ser = FpXX_red(ser, q); } else { ser = gmul(z, ser); for (i=2; i<lg(ser); i++) ser[i] = (long)FpX_rem((GEN)ser[i], cyc, q); } a = va[j+1]; } if (low_stack(lim, stack_lim(av, 1))) { if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva); gerepileall(av, 2, &rep, &ser); } } return rep;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/75bbe23ab8ce138cca18cb88feeca14172e80520/trans3.c/clean/src/basemath/trans3.c
if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva);
if(DEBUGMEM>1) err(warnmem, "twistpartialzeta, j = %ld/%ld", j,lva);
twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff){ long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N; pari_sp av, lim; GEN x = polx[0], y = polx[fetch_user_var("y")], eta, one, mon, den; GEN cyc, psm, invden, rep, ser; cyc = gdiv(gsubgs(gpowgs(y, c), 1), gsubgs(y, 1)); psm = polsym(cyc, degpol(cyc) - 1); eta = gmodulcp(y, cyc); one = gmodulsg(1, q); /* Mod(1, q); */ mon = gaddsg(1, x); den = gsubsg(1, gmul(gpowgs(gmul(one,eta), f), gpowgs(gmul(one,mon), f))); /* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5)); av = avma; lim = stack_lim(av, 1); invden = ginv(den); rep = zerovec(lva); /* a = 1 is always the first element of va */ ser = gmul(gmul(eta, mon), invden); ser = lift_intern(lift_intern(ser)); /* t_SER of ZY */ /* ser is a unit, convert to POL */ ser[0] = evaltyp(t_POL)| evallg(lg(ser)); ser[1] = evalsigne(1)| evalvarn(0); a = 1; for (j = 1; j <= lva; j++) { GEN p1 = gzero; if (DEBUGLEVEL > 2 && !(j%50)) fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva); for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p2 = quicktrace(polcoeff_i(ser,k,0), psm); p1 = gerepileupto(av2, addii(p1, mulii((GEN)cff[k], p2))); } rep[j] = lmodii(p1, q); if (j < lva) { long e = va[j+1] - a, i; GEN z = eta; for (i = 1; i <= e; i++) /* assume e small */ { ser = addmulXn(ser, ser, 1); /* ser *= 1+x */ setlg(ser, lg(ser)-1); /* truncate highest degree term */ } if (e > 1) z = gpowgs(z, e); z = lift_intern(z); if (!degpol(z)) { z = (GEN)z[2]; /* +/- 1 */ if (signe(z) < 0) ser = gneg(ser); ser = FpXX_red(ser, q); } else { ser = gmul(z, ser); for (i=2; i<lg(ser); i++) ser[i] = (long)FpX_rem((GEN)ser[i], cyc, q); } a = va[j+1]; } if (low_stack(lim, stack_lim(av, 1))) { if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva); gerepileall(av, 2, &rep, &ser); } } return rep;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/75bbe23ab8ce138cca18cb88feeca14172e80520/trans3.c/clean/src/basemath/trans3.c
if (DEBUGLEVEL) fprintferr("unit exponents = %Z",c);
if (DEBUGLEVEL) fprintferr("unit exponents = %Z\n",c);
reducebetanaive(GEN be, GEN b){ long i,k,n,ru,r1, prec = nfgetprec(bnfz); GEN z,p1,p2,nmax,c, nf = checknf(bnfz); if (DEBUGLEVEL) fprintferr("reduce modulo (Z_K^*)^l\n"); r1 = nf_get_r1(nf); if (!b) b = gmul(gmael(nf,5,1), algtobasis(nf,be)); n = max((ell>>1), 3); z = cgetg(n+1, t_VEC); c = gmulgs(greal((GEN)bnfz[3]), ell); c = logarch2arch(c, r1, prec); /* = embeddings of fu^ell */ c = gprec_w(gnorm(c), DEFAULTPREC); b = gprec_w(gnorm(b), DEFAULTPREC); /* need little precision */ z[1] = (long)concatsp(c, vecinv(c)); for (k=2; k<=n; k++) z[k] = (long) vecmul((GEN)z[1], (GEN)z[k-1]); nmax = T2_from_embed_norm(b, r1); ru = lg(c)-1; c = zerovec(ru); for(;;) { GEN B = NULL; long besti = 0, bestk = 0; for (k=1; k<=n; k++) for (i=1; i<=ru; i++) { p1 = vecmul(b, gmael(z,k,i)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk = k; continue; } p1 = vecmul(b, gmael(z,k,i+ru)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk =-k; } } if (!B) break; b = B; c[besti] = laddis((GEN)c[besti], bestk); } if (DEBUGLEVEL) fprintferr("unit exponents = %Z",c); return fix_be(be,c);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/dac711438fc2e747b8549770d83e84181187a45c/kummer.c/clean/src/modules/kummer.c
prevPhase = phase; phase = PHASE_INITIALIZE;
prevPhase = pppd_phase; pppd_phase = PHASE_INITIALIZE;
int rtems_pppd_set_option(const char *pOption, const char *pValue){ int iReturn = (int)0; int prevPhase; struct wordlist option; struct wordlist value; if ( pOption != (const char *)0 ) { /* initialize the values */ option.word = (char *)pOption; option.next = (struct wordlist *)0; if ( pValue != (const char *)0 ) { option.next = &value; value.word = (char *)pValue; value.next = (struct wordlist *)0; } /* save current phase value */ prevPhase = phase; phase = PHASE_INITIALIZE; /* process option and reset phase value */ iReturn = options_from_list(&option, 1); phase = prevPhase; } return ( iReturn );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/rtemspppd.c/clean/cpukit/pppd/rtemspppd.c
phase = prevPhase;
pppd_phase = prevPhase;
int rtems_pppd_set_option(const char *pOption, const char *pValue){ int iReturn = (int)0; int prevPhase; struct wordlist option; struct wordlist value; if ( pOption != (const char *)0 ) { /* initialize the values */ option.word = (char *)pOption; option.next = (struct wordlist *)0; if ( pValue != (const char *)0 ) { option.next = &value; value.word = (char *)pValue; value.next = (struct wordlist *)0; } /* save current phase value */ prevPhase = phase; phase = PHASE_INITIALIZE; /* process option and reset phase value */ iReturn = options_from_list(&option, 1); phase = prevPhase; } return ( iReturn );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/rtemspppd.c/clean/cpukit/pppd/rtemspppd.c
Objects_Name name,
rtems_name name,
rtems_status_code rtems_region_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 page_size, rtems_attribute attribute_set, Objects_Id *id){ Region_Control *the_region; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_region->maximum_segment_size = _Heap_Initialize(&the_region->Memory, starting_address, length, page_size); if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); _Thread_Enable_dispatch(); return( RTEMS_INVALID_SIZE ); } the_region->starting_address = starting_address; the_region->length = length; the_region->page_size = page_size; the_region->attribute_set = attribute_set; the_region->number_of_used_blocks = 0; _Thread_queue_Initialize( &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT ); _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/region.c/buggy/cpukit/rtems/src/region.c
if ( !_Objects_Is_name_valid( name ) )
if ( !rtems_is_name_valid( name ) )
rtems_status_code rtems_region_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 page_size, rtems_attribute attribute_set, Objects_Id *id){ Region_Control *the_region; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_region->maximum_segment_size = _Heap_Initialize(&the_region->Memory, starting_address, length, page_size); if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); _Thread_Enable_dispatch(); return( RTEMS_INVALID_SIZE ); } the_region->starting_address = starting_address; the_region->length = length; the_region->page_size = page_size; the_region->attribute_set = attribute_set; the_region->number_of_used_blocks = 0; _Thread_queue_Initialize( &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT ); _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/region.c/buggy/cpukit/rtems/src/region.c
_Objects_Open( &_Region_Information, &the_region->Object, name );
_Objects_Open( &_Region_Information, &the_region->Object, &name );
rtems_status_code rtems_region_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 page_size, rtems_attribute attribute_set, Objects_Id *id){ Region_Control *the_region; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_region->maximum_segment_size = _Heap_Initialize(&the_region->Memory, starting_address, length, page_size); if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); _Thread_Enable_dispatch(); return( RTEMS_INVALID_SIZE ); } the_region->starting_address = starting_address; the_region->length = length; the_region->page_size = page_size; the_region->attribute_set = attribute_set; the_region->number_of_used_blocks = 0; _Thread_queue_Initialize( &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT ); _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/region.c/buggy/cpukit/rtems/src/region.c
Objects_Name name,
rtems_name name,
rtems_status_code rtems_region_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Region_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/region.c/buggy/cpukit/rtems/src/region.c
name,
&name,
rtems_status_code rtems_region_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Region_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/region.c/buggy/cpukit/rtems/src/region.c
if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */
/* * Unless provided a valid name that did not already exist * and we are willing to create then it is an error. */ if ( !( status == ENOENT && (oflag & O_CREAT) ) ) { _Thread_Enable_dispatch(); set_errno_and_return_minus_one_cast( status, mqd_t );
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/7fbef7863951899f518b70548f508ad618f9ebbd/mqueueopen.c/buggy/cpukit/posix/src/mqueueopen.c
set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1;
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/7fbef7863951899f518b70548f508ad618f9ebbd/mqueueopen.c/buggy/cpukit/posix/src/mqueueopen.c
set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1;
_Thread_Enable_dispatch(); set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/7fbef7863951899f518b70548f508ad618f9ebbd/mqueueopen.c/buggy/cpukit/posix/src/mqueueopen.c
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/7fbef7863951899f518b70548f508ad618f9ebbd/mqueueopen.c/buggy/cpukit/posix/src/mqueueopen.c
the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/7fbef7863951899f518b70548f508ad618f9ebbd/mqueueopen.c/buggy/cpukit/posix/src/mqueueopen.c
return (mqd_t)&the_mq->Object.id;
_Thread_Enable_dispatch(); _Thread_Enable_dispatch(); return (mqd_t)the_mq->Object.id;
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/7fbef7863951899f518b70548f508ad618f9ebbd/mqueueopen.c/buggy/cpukit/posix/src/mqueueopen.c
return (mqd_t) &the_mq->Object.id;
return (mqd_t) the_mq->Object.id;
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/7fbef7863951899f518b70548f508ad618f9ebbd/mqueueopen.c/buggy/cpukit/posix/src/mqueueopen.c
if (lx==1) return gzero;/*now lx>=2*/
gtrace(GEN x){ long i,l,n,tx=typ(x),lx,tetpil; GEN y,p1,p2; switch(tx) { case t_INT: case t_REAL: case t_FRAC: case t_FRACN: return gmul2n(x,1); case t_COMPLEX: return gmul2n((GEN)x[1],1); case t_QUAD: p1=(GEN)x[1]; if (!gcmp0((GEN) p1[3])) { l=avma; p2=gmul2n((GEN)x[2],1); tetpil=avma; return gerepile(l,tetpil,gadd((GEN)x[3],p2)); } return gmul2n((GEN)x[2],1); case t_POL: lx=lgef(x); y=cgetg(lx,tx); y[1]=x[1]; for (i=2; i<lx; i++) y[i]=ltrace((GEN)x[i]); return y; case t_SER: lx=lg(x); y=cgetg(lx,tx); y[1]=x[1]; for (i=2; i<lx; i++) y[i]=ltrace((GEN)x[i]); return y; case t_POLMOD: l=avma; n=(lgef(x[1])-4); p1=polsym((GEN)x[1],n); p2=gzero; for (i=0; i<=n; i++) p2=gadd(p2,gmul(truecoeff((GEN)x[2],i),(GEN)p1[i+1])); return gerepileupto(l,p2); case t_RFRAC: case t_RFRACN: return gadd(x,gconj(x)); case t_VEC: case t_COL: lx=lg(x); y=cgetg(lx,tx); for (i=1; i<lx; i++) y[i]=ltrace((GEN)x[i]); return y; case t_MAT: lx=lg(x); if (lx!=lg(x[1])) err(mattype1,"gtrace"); l=avma; p1=gcoeff(x,1,1); if (lx==2) return gcopy(p1); for (i=2; i<lx-1; i++) p1=gadd(p1,gcoeff(x,i,i)); tetpil=avma; return gerepile(l,tetpil,gadd(p1,gcoeff(x,i,i))); } err(typeer,"gtrace"); return NULL; /* not reached */}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/9994a44d79945c2def879828fd06b341ee460cc1/alglin2.c/buggy/src/basemath/alglin2.c
gscalcol(GEN x, long n) { return gscalcol_proto(gcopy(x),gzero,n); }
gscalcol(GEN x, long n) { GEN y=gscalcol_proto(gzero,gzero,n); if (n) y[1]=lcopy(x); return y; }
gscalcol(GEN x, long n) { return gscalcol_proto(gcopy(x),gzero,n); }
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2c12c5b47f17fc0cd86edbb21e669c3ac5a90485/alglin1.c/buggy/src/basemath/alglin1.c
GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy);
GEN dx, dy; dx = denom(x); x = gmul(x, dx); dy = denom(y); y = gmul(y, dy);
gauss_gcd(GEN x, GEN y){ pari_sp av = avma; GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy); while (!gcmp0(y)) { GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y)); x = y; y = z; } x = gauss_normal(x); if (typ(x) == t_COMPLEX) { if (gcmp0((GEN)x[2])) x = (GEN)x[1]; else if (gcmp0((GEN)x[1])) x = (GEN)x[2]; } return gerepileupto(av, gdiv(x, den));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2edc82b0d172402925241429eca01a236af8dd01/polarit2.c/clean/src/basemath/polarit2.c
GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y));
GEN z = gsub(x, gmul(ground(gdiv(x,y)), y));
gauss_gcd(GEN x, GEN y){ pari_sp av = avma; GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy); while (!gcmp0(y)) { GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y)); x = y; y = z; } x = gauss_normal(x); if (typ(x) == t_COMPLEX) { if (gcmp0((GEN)x[2])) x = (GEN)x[1]; else if (gcmp0((GEN)x[1])) x = (GEN)x[2]; } return gerepileupto(av, gdiv(x, den));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2edc82b0d172402925241429eca01a236af8dd01/polarit2.c/clean/src/basemath/polarit2.c
return gerepileupto(av, gdiv(x, den));
return gerepileupto(av, gdiv(x, mpppcm(dx, dy)));
gauss_gcd(GEN x, GEN y){ pari_sp av = avma; GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy); while (!gcmp0(y)) { GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y)); x = y; y = z; } x = gauss_normal(x); if (typ(x) == t_COMPLEX) { if (gcmp0((GEN)x[2])) x = (GEN)x[1]; else if (gcmp0((GEN)x[1])) x = (GEN)x[2]; } return gerepileupto(av, gdiv(x, den));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2edc82b0d172402925241429eca01a236af8dd01/polarit2.c/clean/src/basemath/polarit2.c
Fp_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN p)
Fp_gauss_get_col(GEN a, GEN b, GEN invpiv, long li, GEN p)
Fp_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN p){ GEN m, u=cgetg(li+1,t_COL); long i,j; u[li] = lresii(mulii((GEN)b[li], mpinvmod(piv,p)), p); for (i=li-1; i>0; i--) { pari_sp av = avma; m = (GEN)b[i]; for (j=i+1; j<=li; j++) m = subii(m, mulii(gcoeff(a,i,j), (GEN)u[j])); m = resii(m, p); u[i] = lpileuptoint(av, resii(mulii(m, mpinvmod(gcoeff(a,i,i), p)), p)); } return u;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/0413a80bd91a41fc053e0149a3c6bf7d1e6f290c/alglin1.c/buggy/src/basemath/alglin1.c
u[li] = lresii(mulii((GEN)b[li], mpinvmod(piv,p)), p);
u[li] = lresii(mulii((GEN)b[li], invpiv), p);
Fp_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN p){ GEN m, u=cgetg(li+1,t_COL); long i,j; u[li] = lresii(mulii((GEN)b[li], mpinvmod(piv,p)), p); for (i=li-1; i>0; i--) { pari_sp av = avma; m = (GEN)b[i]; for (j=i+1; j<=li; j++) m = subii(m, mulii(gcoeff(a,i,j), (GEN)u[j])); m = resii(m, p); u[i] = lpileuptoint(av, resii(mulii(m, mpinvmod(gcoeff(a,i,i), p)), p)); } return u;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/0413a80bd91a41fc053e0149a3c6bf7d1e6f290c/alglin1.c/buggy/src/basemath/alglin1.c
gerepile_gauss(GEN x,long m,long n,long k,long t,long av, long j, GEN c)
gerepile_gauss(GEN x,long m,long n,long k,long t,ulong av, long j, GEN c)
gerepile_gauss(GEN x,long m,long n,long k,long t,long av, long j, GEN c){ long tetpil = avma,dec,u,A,i; if (DEBUGMEM > 1) err(warnmem,"gauss_pivot. k=%ld, n=%ld",k,n); for (u=t+1; u<=m; u++) if (u==j || !c[u]) copyifstack(coeff(x,u,k), coeff(x,u,k)); for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) copyifstack(coeff(x,u,i), coeff(x,u,i)); (void)gerepile(av,tetpil,NULL); dec = av-tetpil; for (u=t+1; u<=m; u++) if (u==j || !c[u]) { A=coeff(x,u,k); if (A<av && A>=bot) coeff(x,u,k)+=dec; } for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) { A=coeff(x,u,i); if (A<av && A>=bot) coeff(x,u,i)+=dec; }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/9749d3e46caef3f61b412b608c8ac51b8f010460/alglin1.c/clean/src/basemath/alglin1.c
long tetpil = avma,dec,u,A,i;
ulong tetpil = avma,A; long dec,u,i;
gerepile_gauss(GEN x,long m,long n,long k,long t,long av, long j, GEN c){ long tetpil = avma,dec,u,A,i; if (DEBUGMEM > 1) err(warnmem,"gauss_pivot. k=%ld, n=%ld",k,n); for (u=t+1; u<=m; u++) if (u==j || !c[u]) copyifstack(coeff(x,u,k), coeff(x,u,k)); for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) copyifstack(coeff(x,u,i), coeff(x,u,i)); (void)gerepile(av,tetpil,NULL); dec = av-tetpil; for (u=t+1; u<=m; u++) if (u==j || !c[u]) { A=coeff(x,u,k); if (A<av && A>=bot) coeff(x,u,k)+=dec; } for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) { A=coeff(x,u,i); if (A<av && A>=bot) coeff(x,u,i)+=dec; }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/9749d3e46caef3f61b412b608c8ac51b8f010460/alglin1.c/clean/src/basemath/alglin1.c
int i = 0;
register int i = 0;
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1e57186135611e477dfae2764800fa1744bc9b14/imfs_gtkn.c/clean/c/src/lib/libc/imfs_gtkn.c
while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i];
token[i] = c;
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1e57186135611e477dfae2764800fa1744bc9b14/imfs_gtkn.c/clean/c/src/lib/libc/imfs_gtkn.c
if ( !IMFS_is_valid_name_char( token[i] ) )
if ( !IMFS_is_valid_name_char(c) )
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1e57186135611e477dfae2764800fa1744bc9b14/imfs_gtkn.c/clean/c/src/lib/libc/imfs_gtkn.c
i++;
c = path [++i];
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1e57186135611e477dfae2764800fa1744bc9b14/imfs_gtkn.c/clean/c/src/lib/libc/imfs_gtkn.c
token[i] = path[i];
token[i] = c;
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1e57186135611e477dfae2764800fa1744bc9b14/imfs_gtkn.c/clean/c/src/lib/libc/imfs_gtkn.c
s = apr_pstrmemdup(pool, data, len); printf("%s", s);
if (len) { s = apr_pstrmemdup(pool, data, len); printf("%s", s); }
static apr_status_t handle_response(serf_bucket_t *response, void *handler_baton, apr_pool_t *pool){ const char *data, *s; apr_size_t len; serf_status_line sl; apr_status_t status; handler_baton_t *ctx = handler_baton; status = serf_bucket_response_status(response, &sl); if (status) { if (APR_STATUS_IS_EAGAIN(status)) { return APR_SUCCESS; } abort(); } status = serf_bucket_read(response, 2048, &data, &len); if (!status || APR_STATUS_IS_EOF(status)) { s = apr_pstrmemdup(pool, data, len); printf("%s", s); } else if (APR_STATUS_IS_EAGAIN(status)) { status = APR_SUCCESS; } if (APR_STATUS_IS_EOF(status)) { apr_atomic_dec32(&ctx->requests_outstanding); } return status;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/5e7402ef9b9909e5cf94752a014b791cb16c94d0/serf_response.c/clean/test/serf_response.c
serf_bucket_t *hdrs; const char *v; hdrs = serf_bucket_response_get_headers(response); v = serf_bucket_headers_get(hdrs, "Trailer-Test"); if (v) { printf("Trailer-Test: %s\n", v); }
static apr_status_t handle_response(serf_bucket_t *response, void *handler_baton, apr_pool_t *pool){ const char *data, *s; apr_size_t len; serf_status_line sl; apr_status_t status; handler_baton_t *ctx = handler_baton; status = serf_bucket_response_status(response, &sl); if (status) { if (APR_STATUS_IS_EAGAIN(status)) { return APR_SUCCESS; } abort(); } status = serf_bucket_read(response, 2048, &data, &len); if (!status || APR_STATUS_IS_EOF(status)) { s = apr_pstrmemdup(pool, data, len); printf("%s", s); } else if (APR_STATUS_IS_EAGAIN(status)) { status = APR_SUCCESS; } if (APR_STATUS_IS_EOF(status)) { apr_atomic_dec32(&ctx->requests_outstanding); } return status;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/5e7402ef9b9909e5cf94752a014b791cb16c94d0/serf_response.c/clean/test/serf_response.c
register rtems_unsigned32 chn;
register uint32_t chn;
mcfuart_reset(mcfuart *uart){ register rtems_unsigned32 chn; rtems_status_code rc; if (uart == NULL) return RTEMS_INVALID_ADDRESS; chn = uart->chn; /* Reset the receiver and transmitter */ *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_RX; *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_TX; /* * Program the vector number for a UART module interrupt, or * disable UART interrupts if polled I/O. Enable the desired * interrupt sources. */ if (uart->intvec != 0) { int_driven_uart[chn - 1].uart = uart; int_driven_uart[chn - 1].vec = uart->intvec; rc = rtems_interrupt_catch(mcfuart_interrupt_handler, uart->intvec, &uart->old_handler); if (rc != RTEMS_SUCCESSFUL) return rc; *MCF5206E_UIVR(MBAR,chn) = uart->intvec; *MCF5206E_UIMR(MBAR,chn) = MCF5206E_UIMR_FFULL; *MCF5206E_UACR(MBAR,chn) = MCF5206E_UACR_IEC; *MCF5206E_IMR(MBAR) &= ~MCF5206E_INTR_BIT(uart->chn == 1 ? MCF5206E_INTR_UART_1 : MCF5206E_INTR_UART_2); } else { *MCF5206E_UIMR(MBAR,chn) = 0; } /* Select the receiver and transmitter clock. */ mcfuart_set_baudrate(uart, B19200); /* dBUG defaults (unfortunately, it is differ to termios default */ *MCF5206E_UCSR(MBAR,chn) = MCF5206E_UCSR_RCS_TIMER | MCF5206E_UCSR_TCS_TIMER; /* Mode Registers 1,2 - set termios defaults (8N1) */ *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_MR; *MCF5206E_UMR(MBAR,chn) = /* MCF5206E_UMR1_RXRTS | */ MCF5206E_UMR1_PM_NO_PARITY | MCF5206E_UMR1_BC_8; *MCF5206E_UMR(MBAR,chn) = MCF5206E_UMR2_CM_NORMAL |/* MCF5206E_UMR2_TXCTS | */ MCF5206E_UMR2_SB_1; /* Enable Receiver and Transmitter */ *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_ERR; *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_TC_ENABLE; *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_RC_ENABLE; return RTEMS_SUCCESSFUL;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/8bc4430b7be84f0bfa8913693775166ae420fc41/mcfuart.c/clean/c/src/lib/libcpu/m68k/mcf5206/console/mcfuart.c
int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2;
const ulong mask = (1<<kglob)-1; int pk,i,j,LE=0; ulong s,e; GEN tabt,taba,m,E=gzero,p1;
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
pk = _pk(p,k);
pk = u_pow(p,k);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]);
for (i=1; i<=pk; i++) p1[i] = lmod(gpowgs(polx[0],i-1), tabcyc[pk]);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL);
LE = pk - pk/p + 1; E = cgetg(LE,t_VECSMALL);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
if (i%p) E[++j]=i;
if (i%p) E[++j] = i;
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
if ((i%8)==1 || (i%8)==3) E[++j]=i;
if ((i%8)==1 || (i%8)==3) E[++j] = i;
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
p2=cgetg(3,t_VECSMALL);
GEN p2 = cgetg(3,t_VECSMALL);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++)
for (e=1; e<=ltab && signe(m); e++)
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob;
s = vali(m); m = shifti(m,-s); tabt[e] = e==1? s: s+kglob; taba[e] = signe(m)? ((modBIL(m) & mask)+1)>>1: 0; m = shifti(m, -kglob);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;
if (e > ltab) err(bugparier,"filltabs"); setlg(taba, e); tabaall[pk] = taba; setlg(tabt, e); tabtall[pk] = tabt;
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8ac2292b2e02fd23dcdd96371571717ef1011e3f/aprcl.c/clean/src/modules/aprcl.c
ptegOf(Triv121PgTbl pt, unsigned long hash)
ptegOf (Triv121PgTbl pt, unsigned long hash)
ptegOf(Triv121PgTbl pt, unsigned long hash){ hash &= ((1<<LD_HASH_SIZE)-1); return (PTE)(((unsigned long)pt->base) | ((hash<<LD_PTEG_SIZE) & (pt->size-1)));}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1b1b43ccc1a6d654199ddb6329366d2e44bdaea3/pte121.c/clean/c/src/lib/libcpu/powerpc/mpc6xx/mmu/pte121.c
hash &= ((1<<LD_HASH_SIZE)-1); return (PTE)(((unsigned long)pt->base) | ((hash<<LD_PTEG_SIZE) & (pt->size-1)));
hash &= ((1 << LD_HASH_SIZE) - 1); return (APte) (((unsigned long) pt-> base) | ((hash << LD_PTEG_SIZE) & (pt->size - 1)));
ptegOf(Triv121PgTbl pt, unsigned long hash){ hash &= ((1<<LD_HASH_SIZE)-1); return (PTE)(((unsigned long)pt->base) | ((hash<<LD_PTEG_SIZE) & (pt->size-1)));}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1b1b43ccc1a6d654199ddb6329366d2e44bdaea3/pte121.c/clean/c/src/lib/libcpu/powerpc/mpc6xx/mmu/pte121.c
Objects_Name name,
rtems_name name,
rtems_status_code rtems_timer_create( Objects_Name name, Objects_Id *id){ Timer_Control *the_timer; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_timer = _Timer_Allocate(); if ( !the_timer ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_timer->the_class = TIMER_DORMANT; _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/rtemstimer.c/clean/cpukit/rtems/src/rtemstimer.c
if ( !_Objects_Is_name_valid( name ) )
if ( !rtems_is_name_valid( name ) )
rtems_status_code rtems_timer_create( Objects_Name name, Objects_Id *id){ Timer_Control *the_timer; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_timer = _Timer_Allocate(); if ( !the_timer ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_timer->the_class = TIMER_DORMANT; _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/rtemstimer.c/clean/cpukit/rtems/src/rtemstimer.c
_Objects_Open( &_Timer_Information, &the_timer->Object, name );
_Objects_Open( &_Timer_Information, &the_timer->Object, &name );
rtems_status_code rtems_timer_create( Objects_Name name, Objects_Id *id){ Timer_Control *the_timer; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_timer = _Timer_Allocate(); if ( !the_timer ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_timer->the_class = TIMER_DORMANT; _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/rtemstimer.c/clean/cpukit/rtems/src/rtemstimer.c
Objects_Name name,
rtems_name name,
rtems_status_code rtems_timer_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Timer_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/rtemstimer.c/clean/cpukit/rtems/src/rtemstimer.c
name,
&name,
rtems_status_code rtems_timer_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Timer_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/rtemstimer.c/clean/cpukit/rtems/src/rtemstimer.c
return 0;
NS16550_STATIC int ns16550_set_attributes( int minor, const struct termios *t){ unsigned32 pNS16550; unsigned32 ulBaudDivisor; unsigned8 ucLineControl; unsigned32 baud_requested; setRegister_f setReg; getRegister_f getReg; unsigned32 Irql; pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; setReg = Console_Port_Tbl[minor].setRegister; getReg = Console_Port_Tbl[minor].getRegister; /* * Calculate the baud rate divisor */ baud_requested = t->c_cflag & CBAUD; if (!baud_requested) baud_requested = B9600; /* default to 9600 baud */ ulBaudDivisor = termios_baud_to_number(baud_requested); ucLineControl = 0; /* * Parity */ if (t->c_cflag & PARENB) { ucLineControl |= SP_LINE_PAR; if (!(t->c_cflag & PARODD)) ucLineControl |= SP_LINE_ODD; } /* * Character Size */ if (t->c_cflag & CSIZE) { switch (t->c_cflag & CSIZE) { case CS5: ucLineControl |= FIVE_BITS; break; case CS6: ucLineControl |= SIX_BITS; break; case CS7: ucLineControl |= SEVEN_BITS; break; case CS8: ucLineControl |= EIGHT_BITS; break; } } else { ucLineControl |= EIGHT_BITS; /* default to 9600,8,N,1 */ } /* * Stop Bits */ if (t->c_cflag & CSTOPB) { ucLineControl |= SP_LINE_STOP; /* 2 stop bits */ } else { ; /* 1 stop bit */ } /* * Now actually set the chip */ rtems_interrupt_disable(Irql); /* * Set the baud rate */ (*setReg)(pNS16550, NS16550_LINE_CONTROL, SP_LINE_DLAB); /* XXX are these registers right? */ (*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, ulBaudDivisor&0xff); (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, (ulBaudDivisor>>8)&0xff); /* * Now write the line control */ (*setReg)(pNS16550, NS16550_LINE_CONTROL, ucLineControl ); rtems_interrupt_enable(Irql);}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/07a3253de2c3f9bc2d96a351680ec72548dadd2d/ns16550.c/clean/c/src/lib/libchip/serial/ns16550.c
status = EXIT_OK;
pppd_status = EXIT_OK;
np_up(unit, proto) int unit, proto;{ int tlim; if (num_np_up == 0) { /* * At this point we consider that the link has come up successfully. */ status = EXIT_OK; unsuccess = 0; new_phase(PHASE_RUNNING); if (idle_time_hook != 0) tlim = (*idle_time_hook)(NULL); else tlim = idle_time_limit; if (tlim > 0) TIMEOUT(check_idle, NULL, tlim); /* * Set a timeout to close the connection once the maximum * connect time has expired. */ if (maxconnect > 0) TIMEOUT(connect_time_expired, 0, maxconnect); } ++num_np_up;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/auth.c/clean/c/src/libnetworking/pppd/auth.c
cache->chk = cache->base;
init_rel(RELCACHE_t *cache, FB_t *F, long RU){ const long RELSUP = 5; const long n = F->KC + RU-1 + RELSUP; /* expected # of needed relations */ long i, j, k, p; GEN c, P; REL_t *rel; if (DEBUGLEVEL) fprintferr("KCZ = %ld, KC = %ld, n = %ld\n", F->KCZ,F->KC,n); reallocate(cache, 10*n + 50); /* make room for lots of relations */ cache->end = cache->base + n; for (rel = cache->base + 1, i = 1; i <= F->KCZ; i++) { /* trivial relations (p) = prod P^e */ p = F->FB[i]; P = F->LV[p]; if (!isclone(P)) continue; /* all prime divisors in FB */ c = col_0(F->KC); k = F->iLP[p]; rel->nz = k+1; rel->R = c; c += k; rel->ex = NULL; rel->m = NULL; rel->pow= NULL; /* = F->pow */ for (j = lg(P)-1; j; j--) c[j] = itos(gmael(P,j,3)); rel++; } cache->last = rel - 1; if (DEBUGLEVEL) fprintferr("After trivial relations, cglob = %ld\n", cache->last - cache->base);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d69ed6d8e7bab8aead997a49557e9f1f7b600854/buch2.c/clean/src/basemath/buch2.c
case 0: m860.simask |= M860_SIMASK_IRM3; break; case 1: m860.simask |= M860_SIMASK_IRM4; break; case 2: m860.simask |= M860_SIMASK_IRM2; break;
case 0: m8xx.simask |= M8xx_SIMASK_IRM3; break; case 1: m8xx.simask |= M8xx_SIMASK_IRM4; break; case 2: m8xx.simask |= M8xx_SIMASK_IRM2; break;
rtems_device_driver canbus_open( rtems_device_major_number major, rtems_device_minor_number minor, void * arg){ /* msg is in use, rx interrupts are enabled */ candev[minor]->msg15.ctrl0 = 0xff & (I82527_MSG_CTRL_MSGVAL_SET | I82527_MSG_CTRL_RXIE_SET); candev[minor]->ctrl |= I82527_CTRL_IE; candev[minor]->ctrl &= ~(I82527_CTRL_CCE | I82527_CTRL_INIT); switch (minor) { case 0: m860.simask |= M860_SIMASK_IRM3; break; case 1: m860.simask |= M860_SIMASK_IRM4; break; case 2: m860.simask |= M860_SIMASK_IRM2; break; default: return; } return RTEMS_SUCCESSFUL;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52/canbus.c/clean/c/src/lib/libbsp/powerpc/eth_comm/canbus/canbus.c
status = EXIT_HANGUP;
pppd_status = EXIT_HANGUP;
get_input(void){ int len, i; u_char *p; u_short protocol; struct protent *protp; p = inpacket_buf; /* point to beginning of packet buffer */ len = read_packet(inpacket_buf); if (len < 0) return; if (len == 0) { notice("Modem hangup"); hungup = 1; status = EXIT_HANGUP; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; } if (debug /*&& (debugflags & DBG_INPACKET)*/) dbglog("rcvd %P", p, len); if (len < PPP_HDRLEN) { MAINDEBUG(("io(): Received short packet.")); return; } p += 2; /* Skip address and control */ GETSHORT(protocol, p); len -= PPP_HDRLEN; /* * Toss all non-LCP packets unless LCP is OPEN. */ if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) { MAINDEBUG(("get_input: Received non-LCP packet when LCP not open.")); return; } /* * Until we get past the authentication phase, toss all packets * except LCP, LQR and authentication packets. */ if (phase <= PHASE_AUTHENTICATE && !(protocol == PPP_LCP || protocol == PPP_LQR || protocol == PPP_PAP || protocol == PPP_CHAP)) { MAINDEBUG(("get_input: discarding proto 0x%x in phase %d", protocol, phase)); return; } /* * Upcall the proper protocol input routine. */ for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (protp->protocol == protocol && protp->enabled_flag) { (*protp->input)(0, p, len); return; } if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag && protp->datainput != NULL) { (*protp->datainput)(0, p, len); return; } } if (debug) { const char *pname = protocol_name(protocol); if (pname != NULL) warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); else warn("Unsupported protocol 0x%x received", protocol); } lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN); return;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/rtemsmain.c/buggy/c/src/libnetworking/pppd/rtemsmain.c
if (phase <= PHASE_AUTHENTICATE
if (pppd_phase <= PHASE_AUTHENTICATE
get_input(void){ int len, i; u_char *p; u_short protocol; struct protent *protp; p = inpacket_buf; /* point to beginning of packet buffer */ len = read_packet(inpacket_buf); if (len < 0) return; if (len == 0) { notice("Modem hangup"); hungup = 1; status = EXIT_HANGUP; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; } if (debug /*&& (debugflags & DBG_INPACKET)*/) dbglog("rcvd %P", p, len); if (len < PPP_HDRLEN) { MAINDEBUG(("io(): Received short packet.")); return; } p += 2; /* Skip address and control */ GETSHORT(protocol, p); len -= PPP_HDRLEN; /* * Toss all non-LCP packets unless LCP is OPEN. */ if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) { MAINDEBUG(("get_input: Received non-LCP packet when LCP not open.")); return; } /* * Until we get past the authentication phase, toss all packets * except LCP, LQR and authentication packets. */ if (phase <= PHASE_AUTHENTICATE && !(protocol == PPP_LCP || protocol == PPP_LQR || protocol == PPP_PAP || protocol == PPP_CHAP)) { MAINDEBUG(("get_input: discarding proto 0x%x in phase %d", protocol, phase)); return; } /* * Upcall the proper protocol input routine. */ for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (protp->protocol == protocol && protp->enabled_flag) { (*protp->input)(0, p, len); return; } if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag && protp->datainput != NULL) { (*protp->datainput)(0, p, len); return; } } if (debug) { const char *pname = protocol_name(protocol); if (pname != NULL) warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); else warn("Unsupported protocol 0x%x received", protocol); } lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN); return;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/rtemsmain.c/buggy/c/src/libnetworking/pppd/rtemsmain.c
protocol, phase));
protocol, pppd_phase));
get_input(void){ int len, i; u_char *p; u_short protocol; struct protent *protp; p = inpacket_buf; /* point to beginning of packet buffer */ len = read_packet(inpacket_buf); if (len < 0) return; if (len == 0) { notice("Modem hangup"); hungup = 1; status = EXIT_HANGUP; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; } if (debug /*&& (debugflags & DBG_INPACKET)*/) dbglog("rcvd %P", p, len); if (len < PPP_HDRLEN) { MAINDEBUG(("io(): Received short packet.")); return; } p += 2; /* Skip address and control */ GETSHORT(protocol, p); len -= PPP_HDRLEN; /* * Toss all non-LCP packets unless LCP is OPEN. */ if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) { MAINDEBUG(("get_input: Received non-LCP packet when LCP not open.")); return; } /* * Until we get past the authentication phase, toss all packets * except LCP, LQR and authentication packets. */ if (phase <= PHASE_AUTHENTICATE && !(protocol == PPP_LCP || protocol == PPP_LQR || protocol == PPP_PAP || protocol == PPP_CHAP)) { MAINDEBUG(("get_input: discarding proto 0x%x in phase %d", protocol, phase)); return; } /* * Upcall the proper protocol input routine. */ for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (protp->protocol == protocol && protp->enabled_flag) { (*protp->input)(0, p, len); return; } if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag && protp->datainput != NULL) { (*protp->datainput)(0, p, len); return; } } if (debug) { const char *pname = protocol_name(protocol); if (pname != NULL) warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); else warn("Unsupported protocol 0x%x received", protocol); } lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN); return;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/48cdb95aa2444a386a911be1a8251483d79a9935/rtemsmain.c/buggy/c/src/libnetworking/pppd/rtemsmain.c
char *s, c;
const char *s; char c;
escape0(char *tch){ char *s, c; if (compatible != NONE) { s = tch; while (*s) if (*s++ == '=') { GEN (*f)(char*, int) = NULL; int len = (s-tch) - 1; if (!strncmp(tch,"precision",len)) f = sd_realprecision; else if (!strncmp(tch,"serieslength",len)) f = sd_seriesprecision; else if (!strncmp(tch,"format",len)) f = sd_format; else if (!strncmp(tch,"prompt",len)) f = sd_prompt; if (f) { f(get_sep(s), d_ACKNOWLEDGE); return; } break; } } s = tch; switch ((c = *s++)) { case 'w': case 'x': case 'a': case 'b': case 'B': case 'm': { /* history things */ long d; GEN x; if (c != 'w' && c != 'x') d = get_int(s,0); else { d = atol(s); if (*s == '-') s++; while (isdigit((int)*s)) s++; } x = gp_history(GP_DATA->hist, d, tch+1,tch-1); switch (c) { case 'B': { /* prettyprinter */ gp_data G = *GP_DATA; /* copy */ gp_hist h = *(G.hist); /* copy */ pariout_t f = *(G.fmt); /* copy */ G.hist = &h; h.total = 0; /* no hist number */ G.fmt = &f; f.prettyp = f_PRETTY; G.flags &= ~(TEST|TEXMACS); G.lim_lines = 0; gp_output(x, &G); break; } case 'a': brute (x, GP_DATA->fmt->format, -1); break; case 'm': matbrute(x, GP_DATA->fmt->format, -1); break; case 'b': sor(x, GP_DATA->fmt->format, -1, GP_DATA->fmt->fieldw); break; case 'x': voir(x, get_int(s, -1)); break; case 'w': s = get_sep_colon_ok(s); if (!*s) s = current_logfile; write0(s, _vec(x)); return; } pariputc('\n'); return; } case 'c': commands(-1); break; case 'd': help_default(); break; case 'e': s = get_sep(s); if (!*s) s = (GP_DATA->flags & ECHO)? "0": "1"; sd_echo(s,d_ACKNOWLEDGE); break; case 'g': switch (*s) { case 'm': sd_debugmem(++s,d_ACKNOWLEDGE); break; case 'f': sd_debugfiles(++s,d_ACKNOWLEDGE); break; default : sd_debug(s,d_ACKNOWLEDGE); break; } break; case 'h': print_hash_list(s); break; case 'l': s = get_sep_colon_ok(s); if (*s) { sd_logfile(s,d_ACKNOWLEDGE); if (logfile) break; } sd_log(logfile?"0":"1",d_ACKNOWLEDGE); break; case 'o': sd_output(s,d_ACKNOWLEDGE); break; case 'p': switch (*s) { case 's': sd_seriesprecision(++s,d_ACKNOWLEDGE); break; default : sd_realprecision(s,d_ACKNOWLEDGE); break; } break; case 'q': gp_quit(); break; case 'r': s = get_sep_colon_ok(s); switchin(s); if (file_is_binary(infile)) { GEN x = gpreadbin(s); if (isclone(x)) /* many BIN_GEN */ { long i, l = lg(x); err(warner,"setting %ld history entries", l-1); for (i=1; i<l; i++) (void)set_hist_entry(GP_DATA->hist, (GEN)x[i]); } } break; case 's': etatpile(0); break; case 't': gentypes(); break; case 'u': switch (*s) { case 'm': user_member(); break; default: user_fun(); } break; case 'v': print_version(); break; case 'y': s = get_sep(s); if (!*s) s = (GP_DATA->flags & SIMPLIFY)? "0": "1"; sd_simplify(s,d_ACKNOWLEDGE); break; default: err(caracer1,tch-1,tch-2); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6f585501cde8fb54cf37e7b7db1bef2729231dca/gp.c/buggy/src/gp/gp.c
virtual void operator()(T& from,T& to)
void operator()(std::ostream& out) const
virtual void operator()(T& from,T& to) { cout << from << " -> " << to << endl; }
7945 /local/tlutelli/issta_data/temp/c/2005_temp/2005/7945/33690e23354607c3448e82b6f64f5495664c418c/Analyser.h/buggy/src/Analyser.h
cout << from << " -> " << to << endl;
out << "node [shape=box]" << std::endl;
virtual void operator()(T& from,T& to) { cout << from << " -> " << to << endl; }
7945 /local/tlutelli/issta_data/temp/c/2005_temp/2005/7945/33690e23354607c3448e82b6f64f5495664c418c/Analyser.h/buggy/src/Analyser.h
k = 1+bfffo(m); m<<=k; k = BITS_IN_LONG-k;
k = 1+bfffo((ulong)m); m<<=k; k = BITS_IN_LONG-k;
rpowsi(ulong a, GEN n, long prec){ long av,*p,m,k,i,lim; GEN y, unr = realun(prec); GEN (*sq)(GEN); GEN (*mulsg)(long,GEN); if (a == 1) return unr; if (a == 2) { setexpo(unr, itos(n)); return unr; } if (is_pm1(n)) { affsr(a, unr); return unr; } /* be paranoid about memory consumption */ av=avma; lim=stack_lim(av,1); y = stoi(a); p = n+2; m = *p; /* normalize, i.e set highest bit to 1 (we know m != 0) */ k = 1+bfffo(m); m<<=k; k = BITS_IN_LONG-k; /* first bit is now implicit */ sq = &sqri; mulsg = &mulsi; for (i=lgefint(n)-2;;) { for (; k; m<<=1,k--) { y = sq(y); if (m < 0) y = mulsg(a,y); if (lgefint(y) >= prec && typ(y) == t_INT) /* switch to t_REAL */ { sq = &gsqr; mulsg = &mulsr; affir(y, unr); y = unr; } if (low_stack(lim, stack_lim(av,1))) { if (DEBUGMEM>1) err(warnmem,"rpuisssi"); y = gerepileuptoleaf(av,y); } } if (--i == 0) break; m = *++p, k = BITS_IN_LONG; } if (typ(y) == t_INT) { affir(y, unr); y = unr ; } return gerepileuptoleaf(av,y);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6f0450eaf26bb1653fbb257487c2cbc116d69406/trans1.c/buggy/src/basemath/trans1.c
pari_sp av, tetpil;
pari_sp av;
gsqrt(GEN x, long prec){ pari_sp av, tetpil; GEN y, p1, p2; switch(typ(x)) { case t_REAL: return sqrtr(x); case t_INTMOD: y = cgetg(3,t_INTMOD); copyifstack(x[1],y[1]); p1 = Fp_sqrt((GEN)x[2],(GEN)y[1]); if (!p1) err(sqrter5); y[2] = (long)p1; return y; case t_COMPLEX: y = cgetg(3,t_COMPLEX); av = avma; if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); } p1 = gsqr((GEN)x[1]); p2 = gsqr((GEN)x[2]); p1 = gsqrt(gadd(p1,p2), prec); if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; } if (gsigne((GEN)x[1]) < 0) { p1 = sqrtr( gmul2n(gsub(p1,(GEN)x[1]), -1) ); if (gsigne((GEN)x[2]) < 0) setsigne(p1, -signe(p1)); y[2] = (long)gerepileuptoleaf(av, p1); av = avma; y[1] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } else { p1 = sqrtr( gmul2n(gadd(p1,(GEN)x[1]), -1) ); y[1] = (long)gerepileuptoleaf(av, p1); av = avma; y[2] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } return y; case t_PADIC: return padic_sqrt(x); default: av = avma; if (!(y = _toser(x))) break; return gerepileupto(av, ser_powfrac(y, ghalf, prec)); } return transc(gsqrt,x,prec);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans1.c/buggy/src/basemath/trans1.c
if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); }
gsqrt(GEN x, long prec){ pari_sp av, tetpil; GEN y, p1, p2; switch(typ(x)) { case t_REAL: return sqrtr(x); case t_INTMOD: y = cgetg(3,t_INTMOD); copyifstack(x[1],y[1]); p1 = Fp_sqrt((GEN)x[2],(GEN)y[1]); if (!p1) err(sqrter5); y[2] = (long)p1; return y; case t_COMPLEX: y = cgetg(3,t_COMPLEX); av = avma; if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); } p1 = gsqr((GEN)x[1]); p2 = gsqr((GEN)x[2]); p1 = gsqrt(gadd(p1,p2), prec); if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; } if (gsigne((GEN)x[1]) < 0) { p1 = sqrtr( gmul2n(gsub(p1,(GEN)x[1]), -1) ); if (gsigne((GEN)x[2]) < 0) setsigne(p1, -signe(p1)); y[2] = (long)gerepileuptoleaf(av, p1); av = avma; y[1] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } else { p1 = sqrtr( gmul2n(gadd(p1,(GEN)x[1]), -1) ); y[1] = (long)gerepileuptoleaf(av, p1); av = avma; y[2] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } return y; case t_PADIC: return padic_sqrt(x); default: av = avma; if (!(y = _toser(x))) break; return gerepileupto(av, ser_powfrac(y, ghalf, prec)); } return transc(gsqrt,x,prec);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans1.c/buggy/src/basemath/trans1.c
if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; }
if (gcmp0(p1)) { y[1] = y[2] = (long)sqrtr(p1); return y; }
gsqrt(GEN x, long prec){ pari_sp av, tetpil; GEN y, p1, p2; switch(typ(x)) { case t_REAL: return sqrtr(x); case t_INTMOD: y = cgetg(3,t_INTMOD); copyifstack(x[1],y[1]); p1 = Fp_sqrt((GEN)x[2],(GEN)y[1]); if (!p1) err(sqrter5); y[2] = (long)p1; return y; case t_COMPLEX: y = cgetg(3,t_COMPLEX); av = avma; if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); } p1 = gsqr((GEN)x[1]); p2 = gsqr((GEN)x[2]); p1 = gsqrt(gadd(p1,p2), prec); if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; } if (gsigne((GEN)x[1]) < 0) { p1 = sqrtr( gmul2n(gsub(p1,(GEN)x[1]), -1) ); if (gsigne((GEN)x[2]) < 0) setsigne(p1, -signe(p1)); y[2] = (long)gerepileuptoleaf(av, p1); av = avma; y[1] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } else { p1 = sqrtr( gmul2n(gadd(p1,(GEN)x[1]), -1) ); y[1] = (long)gerepileuptoleaf(av, p1); av = avma; y[2] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } return y; case t_PADIC: return padic_sqrt(x); default: av = avma; if (!(y = _toser(x))) break; return gerepileupto(av, ser_powfrac(y, ghalf, prec)); } return transc(gsqrt,x,prec);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans1.c/buggy/src/basemath/trans1.c
if (!sx) { y=cgetr(3); y[1]=x[1]; y[2]=0; return y; }
if (!sx) return realzero_bit(expo(x));
mpexp1(GEN x){ long l,l1,l2,i,n,m,ex,s,av,av2, sx = signe(x); double a,b,alpha,beta, gama = 2.0 /* optimized for SUN3 */; /* KB: 3.0 is better for UltraSparc */ GEN y,p1,p2,p3,p4,unr; if (typ(x)!=t_REAL) err(typeer,"mpexp1"); if (!sx) { y=cgetr(3); y[1]=x[1]; y[2]=0; return y; } l=lg(x); y=cgetr(l); av=avma; /* room for result */ l2 = l+1; ex = expo(x); if (ex > EXMAX) err(talker,"exponent too large in exp"); alpha = -1-log(2+x[2]/C31)-ex*LOG2; beta = 5 + bit_accuracy(l)*LOG2; a = sqrt(beta/(gama*LOG2)); b = (alpha + 0.5*log(beta*gama/LOG2))/LOG2; if (a>=b) { n=(long)(1+sqrt(beta*gama/LOG2)); m=(long)(1+a-b); l2 += m>>TWOPOTBITS_IN_LONG; } else { n=(long)(1+beta/alpha); m=0; } unr=realun(l2); p2=rcopy(unr); setlg(p2,4); p4=cgetr(l2); affrr(x,p4); setsigne(p4,1); if (m) setexpo(p4,ex-m); s=0; l1=4; av2 = avma; for (i=n; i>=2; i--) { setlg(p4,l1); p3 = divrs(p4,i); s -= expo(p3); p1 = mulrr(p3,p2); setlg(p1,l1); l1 += s>>TWOPOTBITS_IN_LONG; if (l1>l2) l1=l2; s %= BITS_IN_LONG; setlg(unr,l1); p1 = addrr(unr,p1); setlg(p2,l1); affrr(p1,p2); avma = av2; } setlg(p2,l2); setlg(p4,l2); p2 = mulrr(p4,p2); for (i=1; i<=m; i++) { setlg(p2,l2); p2 = mulrr(addsr(2,p2),p2); } if (sx == -1) { setlg(unr,l2); p2 = addrr(unr,p2); setlg(p2,l2); p2 = ginv(p2); p2 = subrr(p2,unr); } affrr(p2,y); avma = av; return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1558baf8c3b715dd704e6dddf2c7f1f51dc47e84/trans1.c/buggy/src/basemath/trans1.c
affrr(gmul(v1,u), (GEN)y[1]); affrr(gmul(u1,v), (GEN)y[2]); return y;
affr_fixlg(gmul(v1,u), (GEN)y[1]); affr_fixlg(gmul(u1,v), (GEN)y[2]); return y;
gsin(GEN x, long prec){ pari_sp av; GEN r, u, v, y, v1, u1; long i; switch(typ(x)) { case t_REAL: return mpsin(x); case t_COMPLEX: i = precision(x); if (!i) i = prec; y = cgetc(i); av = avma; r = gexp((GEN)x[2],prec); v1 = gmul2n(addrr(ginv(r),r), -1); /* = cos(I*Im(x)) */ u1 = subrr(r, v1); /* = I*sin(I*Im(x)) */ gsincos((GEN)x[1],&u,&v,prec); affrr(gmul(v1,u), (GEN)y[1]); affrr(gmul(u1,v), (GEN)y[2]); return y; case t_INT: case t_FRAC: y = cgetr(prec); av = avma; /* _not_ afrr: we want to be able to reduce mod Pi */ x = gadd(x, realzero(prec)); affrr(mpsin(x), y); avma = av; return y; case t_INTMOD: case t_PADIC: err(typeer,"gsin"); default: av = avma; if (!(y = _toser(x))) break; if (gcmp0(y)) return gcopy(y); if (valp(y) < 0) err(negexper,"gsin"); gsincos(y,&u,&v,prec); return gerepilecopy(av,u); } return transc(gsin,x,prec);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans1.c/buggy/src/basemath/trans1.c
affrr(mpsin(x), y); avma = av; return y;
affr_fixlg(mpsin(x), y); avma = av; return y;
gsin(GEN x, long prec){ pari_sp av; GEN r, u, v, y, v1, u1; long i; switch(typ(x)) { case t_REAL: return mpsin(x); case t_COMPLEX: i = precision(x); if (!i) i = prec; y = cgetc(i); av = avma; r = gexp((GEN)x[2],prec); v1 = gmul2n(addrr(ginv(r),r), -1); /* = cos(I*Im(x)) */ u1 = subrr(r, v1); /* = I*sin(I*Im(x)) */ gsincos((GEN)x[1],&u,&v,prec); affrr(gmul(v1,u), (GEN)y[1]); affrr(gmul(u1,v), (GEN)y[2]); return y; case t_INT: case t_FRAC: y = cgetr(prec); av = avma; /* _not_ afrr: we want to be able to reduce mod Pi */ x = gadd(x, realzero(prec)); affrr(mpsin(x), y); avma = av; return y; case t_INTMOD: case t_PADIC: err(typeer,"gsin"); default: av = avma; if (!(y = _toser(x))) break; if (gcmp0(y)) return gcopy(y); if (valp(y) < 0) err(negexper,"gsin"); gsincos(y,&u,&v,prec); return gerepilecopy(av,u); } return transc(gsin,x,prec);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans1.c/buggy/src/basemath/trans1.c
affrr(a1,y); avma = av; return y;
affr_fixlg(a1,y); avma = av; return y;
agm1r_abs(GEN x){ long l = lg(x), L = 5-bit_accuracy(l); GEN a1, b1, y = cgetr(l); pari_sp av = avma; a1 = addrr(realun(l), x); setexpo(a1, expo(a1)-1); b1 = sqrtr_abs(x); while (expo(subrr(b1,a1)) - expo(b1) >= L) { GEN a = a1; a1 = addrr(a,b1); setexpo(a1, expo(a1)-1); b1 = sqrtr_abs(mulrr(a,b1)); } affrr(a1,y); avma = av; return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans1.c/buggy/src/basemath/trans1.c