void idperror(int messagedest,char **messages,const char *f, const char *s) { char *buffer; int malloced=0; if(!f) buffer=(char *)s; else if(!s) buffer=(char *)f; else{ buffer=malloc(strlen(f)+strlen(s)+9); sprintf(buffer,f,s); malloced=1; } if(buffer){ #ifndef _MSC_VER ssize_t bytes_ret __attribute__((unused)); #else ssize_t bytes_ret; #endif switch(messagedest){ case CDDA_MESSAGE_PRINTIT: bytes_ret = write(STDERR_FILENO,buffer,strlen(buffer)); if(errno){ bytes_ret = write(STDERR_FILENO,": ",2); bytes_ret = write(STDERR_FILENO,strerror(errno),strlen(strerror(errno))); bytes_ret = write(STDERR_FILENO,"\n",1); } break; case CDDA_MESSAGE_LOGIT: if(messages){ *messages=catstring(*messages,buffer); if(errno){ *messages=catstring(*messages,": "); *messages=catstring(*messages,strerror(errno)); *messages=catstring(*messages,"\n"); } } break; case CDDA_MESSAGE_FORGETIT: default: break; } } if(malloced)free(buffer); }
static bool ifaceeq1(void *data1, void *data2, Type *t) { uintptr size; Alg *alg; Eface err; bool eq; alg = t->alg; size = t->size; if(alg->equal == runtime·noequal) { // calling noequal will panic too, // but we can print a better error. runtime·newErrorString(runtime·catstring(runtime·gostringnocopy((byte*)"comparing uncomparable type "), *t->string), &err); runtime·panic(err); } eq = 0; if(size <= sizeof(data1)) alg->equal(&eq, size, &data1, &data2); else alg->equal(&eq, size, data1, data2); return eq; }
void idmessage(int messagedest,char **messages,const char *f, const char *s) { char *buffer; int malloced=0; #ifndef _MSC_VER ssize_t bytes_ret __attribute__((unused)); #else ssize_t bytes_ret; #endif if(!f) buffer=(char *)s; else if(!s) buffer=(char *)f; else{ const unsigned int i_buffer=strlen(f)+strlen(s)+2; buffer=malloc(i_buffer); sprintf(buffer,f,s); strncat(buffer,"\n",1); malloced=1; } if(buffer) { switch(messagedest){ case CDDA_MESSAGE_PRINTIT: bytes_ret = write(STDERR_FILENO,buffer,strlen(buffer)); if(!malloced) bytes_ret = write(STDERR_FILENO,"\n",1); break; case CDDA_MESSAGE_LOGIT: if(messages){ *messages=catstring(*messages,buffer); if(!malloced)*messages=catstring(*messages,"\n"); } break; case CDDA_MESSAGE_FORGETIT: default: break; } } if(malloced)free(buffer); }
void cdmessage(cdrom_drive_t *d, const char *s) { #ifndef _MSC_VER ssize_t bytes_ret __attribute__((unused)); #else ssize_t bytes_ret; #endif if(s && d){ switch(d->messagedest){ case CDDA_MESSAGE_PRINTIT: bytes_ret = write(STDERR_FILENO, s, strlen(s)); break; case CDDA_MESSAGE_LOGIT: d->messagebuf=catstring(d->messagebuf,s); break; case CDDA_MESSAGE_FORGETIT: default: break; } } }
static uintptr ifacehash1 ( void *data , Type *t , uintptr h ) { Alg *alg; uintptr size; Eface err; #line 464 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc" if ( t == nil ) return 0; #line 467 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc" alg = t->alg; size = t->size; if ( alg->hash == runtime·nohash ) { #line 472 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc" runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "hash of unhashable type " ) , *t->string ) , &err ) ; runtime·panic ( err ) ; } if ( size <= sizeof ( data ) ) alg->hash ( &h , size , &data ) ; else alg->hash ( &h , size , data ) ; return h; }
static bool ifaceeq1 ( void *data1 , void *data2 , Type *t ) { uintptr size; Alg *alg; Eface err; bool eq; #line 504 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc" alg = t->alg; size = t->size; #line 507 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc" if ( alg->equal == runtime·noequal ) { #line 510 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc" runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "comparing uncomparable type " ) , *t->string ) , &err ) ; runtime·panic ( err ) ; } #line 514 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc" eq = 0; if ( size <= sizeof ( data1 ) ) alg->equal ( &eq , size , &data1 , &data2 ) ; else alg->equal ( &eq , size , data1 , data2 ) ; return eq; }
static uintptr ifacehash1(void *data, Type *t, uintptr h) { Alg *alg; uintptr size; Eface err; if(t == nil) return 0; alg = t->alg; size = t->size; if(alg->hash == runtime·nohash) { // calling nohash will panic too, // but we can print a better error. runtime·newErrorString(runtime·catstring(runtime·gostringnocopy((byte*)"hash of unhashable type "), *t->string), &err); runtime·panic(err); } if(size <= sizeof(data)) alg->hash(&h, size, &data); else alg->hash(&h, size, data); return h; }
static bool ifaceeq1 ( void *data1 , void *data2 , Type *t ) { uintptr size; Alg *alg; Eface err; bool eq; #line 533 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc" alg = t->alg; size = t->size; #line 536 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc" if ( alg->equal == runtime·noequal ) { #line 539 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc" runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "comparing uncomparable type " ) , *t->string ) , &err ) ; runtime·panic ( err ) ; } #line 543 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc" eq = 0; if ( size <= sizeof ( data1 ) ) alg->equal ( &eq , size , &data1 , &data2 ) ; else alg->equal ( &eq , size , data1 , data2 ) ; return eq; }