Branch Coverage

lib/PDL/Core/pdlmagic.c
Criterion Covered Total %
branch 57 130 43.8


line true false branch
30 0 90 while(*foo) {
42 25 25 while(*foo) {
43 25 0 if(*foo == mag) {
51 0 25 if( !found ){
59 65 0 if (pdl__ismagic(it) && !pdl__magic_isundestroyable(it)) {
65 0 if (pdl__ismagic(it) && !pdl__magic_isundestroyable(it)) {
61 65 65 while(foo) {
74 130 116522 while(*foo) {
75 0 130 if((*foo)->what & PDL_MAGIC_UNDESTROYABLE) {return 1;}
87 66 66 while(*foo) {
88 0 66 if((*foo)->what & which) {
89 0 0 if((*foo)->what & PDL_MAGIC_DELAYED)
104 3346 1 while(*foo) {
105 3346 0 if((*foo)->what & which) {
116 0 0 while(*foo) {
118 0 0 if((*foo)->what & PDL_MAGIC_MARKCHANGED)
120 0 0 else if ((*foo)->what & PDL_MAGIC_THREADING)
124 0 0 if ((*foo)->what & (PDL_MAGIC_DELAYED|PDL_MAGIC_UNDESTROYABLE))
127 0 0 if ((*foo)->what & PDL_MAGIC_DELAYED)
129 0 0 if ((*foo)->what & PDL_MAGIC_UNDESTROYABLE)
157 0 0 for(i=0; i
172 0 0 PUSHMARK(SP);
174 0 0 FREETMPS; LEAVE;
187 0 0 if (!ptr) return NULL;
194 0 0 if(it->state & PDL_ANYCHANGED)
224 0 572 PDLDEBUG_f(printf("STARTING THREAD %d (%lu)\n",p->no, (long unsigned)pthread_self()));
229 0 572 PDLDEBUG_f(printf("ENDING THREAD %d (%lu)\n",p->no, (long unsigned)pthread_self()));
235 0 133 if(!ptr) return 0;
236 111 22 if (nthdim) *nthdim = ptr->nthdim;
242 0 3073 if(!ptr) return -1;
244 0 3073 if(!p) return -1;
250 0 115 PDL_BRC_CHKMAGIC(broadcast);
0 0 PDL_BRC_CHKMAGIC(broadcast);
254 0 115 if(!ptr) {
260 0 0 PDL_RETERROR(PDL_err, pdl_add_threading_magic(it, broadcast->mag_nth, broadcast->mag_nthr));
266 0 0 if(!ptr) {return pdl_make_error_simple(PDL_EFATAL, "Invalid pdl_magic_thread_cast!");}
280 0 115 PDLDEBUG_f(printf("CREATING THREADS, ME: TBD, key: %ld\n", (unsigned long)(ptr->key)));
282 572 115 for(i=0; imag_nthr; i++) {
288 0 572 if (pthread_create(tp+i, NULL, pthread_perform, tparg+i))
292 0 115 if (last_pthread < broadcast->mag_nthr-1) {
294 0 0 for (i=0; i <= last_pthread; i++)
298 0 115 PDLDEBUG_f(printf("JOINING THREADS, ME: TBD, key: %ld\n", (unsigned long)(ptr->key)));
299 572 115 for(i=0; i<=last_pthread; i++) {
302 0 115 PDLDEBUG_f(printf("FINISHED THREADS, ME: TBD, key: %ld\n", (unsigned long)(ptr->key)));
308 0 115 if( clearMagic ){
309 0 0 PDL_RETERROR(PDL_err, pdl_add_threading_magic(it, -1, -1));
323 0 115 handle_deferred_errors(warn, pdl_pdl_warn("%s", pdl_pthread_warn_msgs));
324 0 115 if (last_pthread < broadcast->mag_nthr-1)
326 0 115 handle_deferred_errors(barf, PDL_err = pdl_error_accumulate(PDL_err, pdl_make_error(PDL_EUSERERROR, "%s", pdl_pthread_barf_msgs)));
327 572 115 for(i=0; imag_nthr; i++) {
339 1 25 if( !ptr) return PDL_err;
341 0 25 PDL_RETERROR(PDL_err, pdl__magic_rm(it, (pdl_magic *) ptr));
355 26 90 if( (nthdim == -1) && ( nthreads == -1 ) ){
26 0 if( (nthdim == -1) && ( nthreads == -1 ) ){
356 0 26 PDL_RETERROR(PDL_err, pdl_rm_threading_magic(it));
360 0 90 if (!ptr) return pdl_make_error_simple(PDL_EFATAL, "Out of memory");
371 1 279 return !done_pdl_main_pthreadID_init || pthread_equal( pdl_main_pthreadID, pthread_self() );
0 1 return !done_pdl_main_pthreadID_init || pthread_equal( pdl_main_pthreadID, pthread_self() );
386 165 0 if (pdl_pthread_main_thread()) return 0;
388 0 0 if(iswarn)
403 0 0 if(iswarn)
424 0 1 if (add_newline) extralen += 1;
429 0 1 if (add_newline) (*p)[*len-2] = '\n';
490 80 0 if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0)
530 0 0 if (!ptr) return pdl_make_error_simple(PDL_EFATAL, "Out of memory");