| author | Jens Thoms Toerring <jt@toerring.de> | 2017年08月15日 20:11:32 +0200 |
|---|---|---|
| committer | Jens Thoms Toerring <jt@toerring.de> | 2017年08月15日 20:11:32 +0200 |
| commit | 4269be27c02b50c513468696c91e4bdf74f6221c (patch) | |
| tree | cfff08661205de9cfee2307ea684cbd07720c4ce | |
| parent | 0b8e2868b82e2cf05645d628220fda8751d351d1 (diff) | |
| download | xforms-4269be27c02b50c513468696c91e4bdf74f6221c.tar.gz | |
diff --git a/doc/part5_overview.texi b/doc/part5_overview.texi index fa97af1..c80e026 100644 --- a/doc/part5_overview.texi +++ b/doc/part5_overview.texi @@ -950,7 +950,7 @@ There are also functions to change or query the border width of an object: @anchor{fl_get_object_bw()} @example void fl_set_object_bw(FL_OBJECT *obj, int bw); -void fl_get_object_bw(FL_OBJECT *obj, int *bw); +int fl_get_object_bw(FL_OBJECT *obj); @end example @noindent If the requested border width is 0, -1 is used. diff --git a/fdesign/fd_file_fun.c b/fdesign/fd_file_fun.c index aa20cc3..fd5ca19 100644 --- a/fdesign/fd_file_fun.c +++ b/fdesign/fd_file_fun.c @@ -196,7 +196,7 @@ ff_get_fd_file( const char * str, if ( ! fdopt.conv_only ) fl_show_alert( "Can't open file for reading", ff.fname, "", 0 ); else - M_err( "ff_get_fd_file", "Can't open '%s' for reading", ff.fname ); + M_err( __func__, "Can't open '%s' for reading", ff.fname ); ff_close( ); return -1; } @@ -206,8 +206,7 @@ ff_get_fd_file( const char * str, if ( ! fdopt.conv_only ) fl_show_alert( "Nothing to be read from", ff.fname, "", 0 ); else - M_err( "ff_get_fd_file", "Nothing to be read from '%s'", - ff.fname ); + M_err( __func__, "Nothing to be read from '%s'", ff.fname ); ff_close( ); return -1; } @@ -993,7 +992,7 @@ ff_read( const char * format, if ( ! format || ! *format ) { - M_err( "ff_read", "Invalid argument(s)" ); + M_err( __func__, "Invalid argument(s)" ); return FF_READ_FAILURE; } @@ -1107,7 +1106,7 @@ ff_read( const char * format, default : /* error, wrong format */ va_end( ap ); fl_free( fmt ); - M_err( "ff_read", "Invalid argument(s)" ); + M_err( __func__, "Invalid argument(s)" ); return FF_READ_FAILURE; } diff --git a/fdesign/fd_forms.c b/fdesign/fd_forms.c index 996013c..ebc8785 100644 --- a/fdesign/fd_forms.c +++ b/fdesign/fd_forms.c @@ -871,12 +871,12 @@ save_forms( const char *str ) } sprintf( cmdbuf, "%s %s%s", conv->extern_convertor, optbuf, filename ); - M_warn( "Convert", "Executing %s", cmdbuf ); + M_warn( __func__, "Executing %s", cmdbuf ); if ( fdopt.conv_only ) { if ( ( status = system( cmdbuf ) ) ) - M_err( "Output", "Error executing %s\n", cmdbuf ); + M_err( __func__, "Error executing %s\n", cmdbuf ); } else { diff --git a/fdesign/fd_main.c b/fdesign/fd_main.c index fda0784..05b815f 100644 --- a/fdesign/fd_main.c +++ b/fdesign/fd_main.c @@ -568,7 +568,7 @@ handle_expose( XEvent * xev, { if ( xev->xexpose.count == 0 ) { - M_warn( "FD_Expose", "" ); + M_warn( __func__, "" ); /* If we have ignored a previous configure event, need the window size might not be correct. Re-read */ @@ -905,7 +905,8 @@ main( int argc, convertor[ fdopt.language ].init( ); fd_bwidth = fli_cntl.borderWidth; - M_warn( "fdesign", "UNIT=%s BW=%d", unit_name( fdopt.unit ), fd_bwidth ); + M_warn( "fdesign main" , + "UNIT=%s BW=%d", unit_name( fdopt.unit ), fd_bwidth ); create_the_forms( ); fl_set_atclose( delete_handler, 0 ); diff --git a/fdesign/fd_objects.c b/fdesign/fd_objects.c index 488551b..541af2e 100644 --- a/fdesign/fd_objects.c +++ b/fdesign/fd_objects.c @@ -129,7 +129,7 @@ find_class_struct( int n ) return classes + i; } - M_err( "find_class_struct", "Can't find class %d", n ); + M_err( __func__, "Can't find class %d", n ); return NULL; } @@ -147,7 +147,7 @@ add_type_def( int cn, if ( tn >= MAXTYPES || tn < 0 ) { - M_err( "add_type_def", "Bad type: %d", tn ); + M_err( __func__, "Bad type: %d", tn ); return; } @@ -812,7 +812,7 @@ find_type_value( int cln, type_name + 3 ) ) ) return j; - M_err( "TypeValue", "type %s is unknown", type_name ); + M_err( __func__, "type %s is unknown", type_name ); return -1; } diff --git a/fdesign/fd_printC.c b/fdesign/fd_printC.c index 492f32c..29ab70a 100644 --- a/fdesign/fd_printC.c +++ b/fdesign/fd_printC.c @@ -55,7 +55,7 @@ make_backup( const char *s ) if ( access( s, R_OK ) ) { if ( errno != ENOENT ) - M_err( "make_backup", "Creating backup file %s.bak failed", s ); + M_err( __func__, "Creating backup file %s.bak failed", s ); return; } @@ -65,14 +65,15 @@ make_backup( const char *s ) #ifdef __EMX__ if ( unlink( buf ) ) { - M_err( "make_backup", "Creating backup file %s failed", buf ); + M_err( __func__, "Creating backup file %s failed", buf ); free( buf ); return; } #endif if ( rename( s, buf ) ) - M_err( "make_backup", "Creating backup file %s failed %s", buf, strerror( errno ) ); + M_err( __func__, "Creating backup file %s failed: %s", + buf, strerror( errno ) ); free( buf ); } @@ -149,7 +150,7 @@ C_output( const char * filename, fl_show_alert( "Can't create header file!", "Filename is too long:", "", 1 ); else - M_err( "C_output", + M_err( __func__, "Can't create header file, filename is too long" ); return 0; } @@ -161,7 +162,7 @@ C_output( const char * filename, if ( ! fdopt.conv_only ) fl_show_alert( "Can't open header file!", fname, "", 1 ); else - M_err( "C_output", "Can't create open header file '%s'", fname ); + M_err( __func__, "Can't create open header file '%s'", fname ); return 0; } @@ -225,7 +226,7 @@ C_output( const char * filename, fl_show_alert( "Can't create C file!", "Filename is too long.", "", 1 ); else - M_err( "C_output", "Can't create C file, filename is too long" ); + M_err( __func__, "Can't create C file, filename is too long" ); return 0; } @@ -236,7 +237,7 @@ C_output( const char * filename, if ( ! fdopt.conv_only ) fl_show_alert( "Can't open C file!", fname, "", 1 ); else - M_err( "C_output", "Can't open C file '%s'", fname ); + M_err( __func__, "Can't open C file '%s'", fname ); return 0; } @@ -267,7 +268,7 @@ C_output( const char * filename, fl_show_alert( "Can't create C file for main() function!", "Filename is too long:", "", 1 ); else - M_err( "C_output", "Can't create C file for main() function, " + M_err( __func__, "Can't create C file for main() function, " "filename is too long" ); reset_dupinfo_cache( ); return 0; @@ -281,7 +282,7 @@ C_output( const char * filename, fl_show_alert( "Can't open file for main() function!", "", "", 1 ); else - M_err( "C_output", "Can't open file for main() function!" ); + M_err( __func__, "Can't open file for main() function!" ); reset_dupinfo_cache( ); return 0; } @@ -304,7 +305,7 @@ C_output( const char * filename, fl_show_alert( "Can't create C file for callbacks!", "Filename is too long:", "", 1 ); else - M_err( "C_output", "Can't create C file for callbacks, " + M_err( __func__, "Can't create C file for callbacks, " "filename is too long" ); reset_dupinfo_cache( ); return 0; @@ -317,8 +318,8 @@ C_output( const char * filename, fl_show_alert( "Can't open C file for callbacks!", fname, "", 1 ); else - M_err( "C_output", - "Can't open C file for callbacks '%s'", fname ); + M_err( __func__, "Can't open C file for callbacks '%s'", + fname ); reset_dupinfo_cache( ); return 0; } @@ -1574,8 +1575,7 @@ output_object( FILE * fp, defobj = find_class_default( obj->objclass, obj->type ); if ( ! defobj ) { - M_err( "output_object", - "Failed to create default (class = %s, type = %s)", + M_err( __func__, "Failed to create default (class = %s, type = %s)", find_class_name( obj->objclass ), find_type_name( obj->objclass, obj->type ) ); exit( 1 ); diff --git a/fdesign/sp_xyplot.c b/fdesign/sp_xyplot.c index 7dd1930..23d173b 100644 --- a/fdesign/sp_xyplot.c +++ b/fdesign/sp_xyplot.c @@ -200,7 +200,7 @@ xyplot_emit_spec_c_code( FILE * fp, if ( ob->objclass != FL_XYPLOT ) { - M_err( "EmitXYPlotCode", "not xyplot class!" ); + M_err( __func__, "object not xyplot class!" ); return; } diff --git a/image/image.c b/image/image.c index 218c118..823d0f8 100644 --- a/image/image.c +++ b/image/image.c @@ -248,7 +248,7 @@ flimage_open( const char * file ) FL_IMAGE *im = identify_image( file ); if ( ! im ) - M_err( "OpenImage", "%s: Unknown image format", file ? file : "null" ); + M_err( __func__, "%s: Unknown image format", file ? file : "null" ); return im; } @@ -600,7 +600,7 @@ convert_type( FL_IMAGE * im, } else { - M_err( "Output", "InternalError: unhandled image type: %s", + M_err( __func__, "InternalError: unhandled image type: %s", flimage_type_name( im->type ) ); im->force_convert = 0; } @@ -1054,8 +1054,7 @@ flimage_add_format( const char * formal_name, if ( strcmp( flimage_io[ i ].formal_name, formal_name ) == 0 && strcmp( flimage_io[ i ].short_name, short_name ) == 0 ) { - M_err( "flimage_add_format", - "%s already supported. Replaced", short_name ); + M_err( __func__, "%s already supported. Replaced", short_name ); k = i + 1; } } @@ -1215,7 +1214,7 @@ flimage_replace_image( FL_IMAGE * im, } else { - M_err( "flimage_replace_image", "InternalError: bad type=%s", + M_err( __func__, "InternalError: bad type=%s", flimage_type_name( im->type ) ); return; } @@ -1338,7 +1337,7 @@ copy_pixels( FL_IMAGE * dim, break; default: - M_err( "copy_pixel", "Bad type: %d", sim->type ); + M_err( __func__, "Bad type: %d", sim->type ); break; } } @@ -1927,7 +1926,7 @@ flimage_read_annotation( FL_IMAGE * im ) { sscanf( buf, "%*s %d %d", &nmarkers, &v ); if ( v > MARKERVERSION ) - M_err( "ReadMarker", "wrong version" ); + M_err( __func__, "wrong version" ); for ( i = 0; i < nmarkers; i++ ) { while ( skip_line( fp ) ) @@ -1941,7 +1940,7 @@ flimage_read_annotation( FL_IMAGE * im ) { sscanf( buf, "%*s %d %d", &ntext, &v ); if ( v > TEXTVERSION ) - M_err( "ReadText", "wrong version" ); + M_err( __func__, "wrong version" ); for ( i = 0; i < ntext; i++ ) { while ( skip_line( fp ) ) diff --git a/image/image_convolve.c b/image/image_convolve.c index 8f4897c..e82ed30 100644 --- a/image/image_convolve.c +++ b/image/image_convolve.c @@ -292,7 +292,7 @@ flimage_convolve( FL_IMAGE * im, if ( !im || im->w <= 0 || im->type == FL_IMAGE_NONE ) { - M_err( "Convolve", "bad image" ); + M_err( __func__, "bad image" ); return -1; } @@ -321,7 +321,7 @@ flimage_convolve( FL_IMAGE * im, } if ( ! ( krow & 1 ) || ! ( kcol & 1 ) ) - M_err( "Convolve", "even or zero kernel size (row = %d, col = %d)!", + M_err( __func__, "even or zero kernel size (row = %d, col = %d)!", krow, kcol ); for ( i = 0; i < kcol * krow; i++ ) @@ -383,7 +383,7 @@ flimage_convolvea( FL_IMAGE * im, status; if ( ! ( krow & 1 ) || ! ( kcol & 1 ) ) - M_err( "Convolve", "even or zero kernel size (row = %d, col = %d)!", + M_err( __func__, "even or zero kernel size (row = %d, col = %d)!", krow, kcol ); kk = fl_make_matrix( krow, kcol, sizeof **kk, kernel ); diff --git a/image/image_disp.c b/image/image_disp.c index 7dca4ac..d3cc6eb 100644 --- a/image/image_disp.c +++ b/image/image_disp.c @@ -74,13 +74,13 @@ get_colors( Colormap colormap, if ( map_len <= 0 ) { - M_err( "get_colors", "bad map length %d\n", map_len ); + M_err( __func__, "bad map length %d\n", map_len ); return 0; } if ( ! ( newpixels = fl_malloc( map_len * sizeof *newpixels ) ) ) { - M_err( "get_colors", "malloc failed while getting colors" ); + M_err( __func__, "malloc failed while getting colors" ); return 0; } @@ -135,7 +135,7 @@ get_all_colors( FL_IMAGE * im, if ( ! mapentry ) { - M_err( "get_all_colors", "malloc failure(%d entries)", max_colors ); + M_err( __func__, "malloc failure(%d entries)", max_colors ); return; } @@ -299,7 +299,7 @@ fl_display_ci( FL_IMAGE * im, ximage->data = ( char * ) xpixels; #if IMAGEDEBUG - M_err( "fl_display_ci", "w=%d bytes_per_line=%d bits_per_pixel=%d", + M_err( __func__, "w=%d bytes_per_line=%d bits_per_pixel=%d", im->w, ximage->bytes_per_line, ximage->bits_per_pixel ); #endif @@ -309,7 +309,7 @@ fl_display_ci( FL_IMAGE * im, { XFree( ximage ); fl_free( xpixels ); - M_err("fl_display_ci", "malloc failed"); + M_err( __func__, "malloc failed" ); return -1; } @@ -406,7 +406,7 @@ fl_display_ci( FL_IMAGE * im, npixels = 0; #if IMAGEDEBUG - M_err( "fl_display_ci", "Grayscale: maplen=%d", im->map_len ); + M_err( __func__, "Grayscale: maplen=%d", im->map_len ); #endif for ( i = 0; i < im->map_len; i++ ) @@ -422,7 +422,7 @@ fl_display_ci( FL_IMAGE * im, im->colors = npixels; #if TRACE - M_err( "fl_display_ci", "Done colormap" ); + M_err( __func__, "Done colormap" ); #endif if ( ximage->bits_per_pixel == 1 ) @@ -453,14 +453,14 @@ fl_display_ci( FL_IMAGE * im, else if ( ximage->bits_per_pixel == 8 ) { #if TRACE - M_err( "fl_display_ci", "Converting %d pixels", im->w * im->h ); + M_err( __func__, "Converting %d pixels", im->w * im->h ); #endif for ( i = 0, total = im->w * im->h; i < total; i++ ) xpixels[ i ] = ( unsigned char ) xc[ ipixels[ i ] ].pixel; } else - M_err( "fl_display_ci", "unhandled bits_per_pixel=%d depth=%d", + M_err( __func__, "unhandled bits_per_pixel=%d depth=%d", ximage->bits_per_pixel, im->depth ); } else if ( im->vclass == StaticColor || im->vclass == PseudoColor ) @@ -474,14 +474,14 @@ fl_display_ci( FL_IMAGE * im, for ( i = 0; i < total; i++ ) xpixels[ i ] = ( unsigned char ) xc[ ipixels[ i ] ].pixel; else - M_err( "fl_display_ci", "unhandled bits_per_pixel=%d depth=%d", + M_err( __func__, "unhandled bits_per_pixel=%d depth=%d", ximage->bits_per_pixel, im->depth ); } else - M_err( "fl_display_ci", "unhandled visual unhandled visual class" ); #if TRACE - M_err( "fl_display_ci", "about to XPutImage" ); + M_err( __func__, "about to XPutImage" ); #endif if ( ximage && ximage->data ) @@ -496,7 +496,7 @@ fl_display_ci( FL_IMAGE * im, fl_free( xmapped ); #if TRACE - M_err( "fl_display_ci", "Leaving" ); + M_err( __func__, "Leaving" ); #endif return 0; @@ -561,14 +561,14 @@ fl_display_gray( FL_IMAGE * im, unsigned short *ci = im->gray[ 0 ]; #if TRACE - M_err( "DisplayGray", "Entering" ); + M_err( __func__, "Entering" ); #endif /* To avoid scaling of the original data, we create display type */ if ( ! ( im->pixels = fl_get_matrix( im->h, im->w, sizeof **im->pixels ) ) ) { - M_err( "DisplayGray", "can't get memory" ); + M_err( __func__, "can't get memory" ); return -1; } @@ -630,7 +630,7 @@ fl_display_gray( FL_IMAGE * im, fl_display_ci( im, win ); #if TRACE - M_err( "DisplayGray", "Leaving" ); + M_err( __func__, "Leaving" ); #endif return 0; @@ -776,12 +776,12 @@ fl_display_rgb( FL_IMAGE * im, } else if ( im->vclass == GrayScale || im->vclass == StaticGray ) { - M_err( "fl_display_rgb", "RGB with grayscale display" ); + M_err( __func__, "RGB with grayscale display" ); return -1; } else if ( im->vclass == PseudoColor || im->vclass == StaticColor ) { - M_err( "fl_display_rgb", "Internal error" ); + M_err( __func__, "Internal error" ); return -1; } else @@ -1458,7 +1458,7 @@ convert_ximage( FL_IMAGE * im, if ( ximage->bits_per_pixel != 1 && ximage->bits_per_pixel % 8 ) { - M_err( "ConvertImage", "unsupported bpp=%d", + M_err( __func__, "unsupported bpp = %d", ximage->bits_per_pixel ); return -1; } @@ -1510,7 +1510,7 @@ convert_ximage( FL_IMAGE * im, { /* Probably very rare */ - M_err( "ConvertXImage", "16bpp grayscale not handled" ); + M_err( __func__, "16 bpp grayscale not handled" ); return -1; } @@ -1596,7 +1596,7 @@ convert_ximage( FL_IMAGE * im, break; default: - M_err( "XImageConvert", "unsupported bpp %d", ximage->depth ); + M_err( __func__, "unsupported bpp %d", ximage->depth ); im->modified = 0; return -1; } diff --git a/image/image_fits.c b/image/image_fits.c index b54420c..ccfe4fe 100644 --- a/image/image_fits.c +++ b/image/image_fits.c @@ -419,7 +419,7 @@ parse_fits_header( FILE * fp, flimage_add_comments( im, buf, 80 ); #if FITS_DEBUG - M_err( "FITS", "key=%s_\t\t val=%s_", key, val ); + M_err( __func__, "key=%s_\t\t val=%s_", key, val ); #endif if ( strcmp( key, "SIMPLE" ) == 0 ) @@ -580,7 +580,7 @@ FITS_load( FL_IMAGE * im ) has_minmax = sp->dmax != sp->dmin; #if FITS_DEBUG - M_err( "fits_load", "sp->dmax=%g sp->dmin=%g", sp->dmax, sp->dmin ); + M_err( __func__, "sp->dmax=%g sp->dmin=%g", sp->dmax, sp->dmin ); #endif /* read the data */ @@ -819,7 +819,7 @@ FITS_next( FL_IMAGE * im ) sp->nframe++; #if FITS_DEBUG - M_err( "FITS_next", "loading %d ", sp->nframe ); + M_err( __func__, "loading %d ", sp->nframe ); #endif status = FITS_load( im ); diff --git a/image/image_gif.c b/image/image_gif.c index 3992bbd..6bfb5df 100644 --- a/image/image_gif.c +++ b/image/image_gif.c @@ -266,7 +266,7 @@ read_descriptor_block( FL_IMAGE * im ) if ( ! sp->globalmap && !local_map ) { - M_err( "GIFDescriptor", "%s: No ColorMap", im->infile ); + M_err( __func__, "%s: No ColorMap", im->infile ); /* return -1; *//* might want to continue */ } @@ -449,7 +449,7 @@ readextension( FILE * fp, switch ( label ) { case GIFEXT_PT : /* plain text extension */ - M_info( 0, "%s: PlainText Extension", im->infile ); + M_info( __func__, "%s: PlainText Extension", im->infile ); if ( getc( fp ) != 12 ) { flimage_error( im, "%s: bad PlainText extension", im->infile ); @@ -470,7 +470,7 @@ readextension( FILE * fp, while ( ( count = getblock( fp, buf ) ) != 0 && count != EOF ) { buf[ count ] = '0円'; - M_info( 0, buf ); + M_info( __func__, buf ); if ( strlen( t->str ) + count > sizeof t->str ) count = sizeof t->str - strlen( t->str ) - 1; strncat( t->str, buf, count ); @@ -479,7 +479,7 @@ readextension( FILE * fp, break; case GIFEXT_COM : /* a comment extension */ - M_info( 0, "%s:Comment Extension", im->infile ); + M_info( __func__, "%s:Comment Extension", im->infile ); while ( ( count = getblock( fp, buf ) ) != 0 && count != EOF ) { buf[ count ] = '0円'; @@ -488,7 +488,7 @@ readextension( FILE * fp, break; case GIFEXT_GC : /* graphics control */ - M_info( 0, "%s:GraphicsControl extension", im->infile ); + M_info( __func__, "%s:GraphicsControl extension", im->infile ); while ( ( count = getblock( fp, buf ) ) != 0 && count != EOF ) { sp->gc.tran = buf[ 0 ] & 1; @@ -500,24 +500,25 @@ readextension( FILE * fp, break; case GIFEXT_APP : /* application extension */ - M_info( 0, "%s:ApplicationExtension", im->infile ); + M_info( __func__, "%s:ApplicationExtension", im->infile ); if ( getc( fp ) != 11 ) /* block length */ - M_warn( "GifExt", "wrong block length" ); + M_warn( __func__, "wrong block length" ); if ( fread( buf, 1, 8, fp ) != 8 ) return EOF; buf[ 8 ] = '0円'; - M_info( 0, buf ); + M_info( __func__, buf ); if ( fread( buf, 1, 3, fp ) != 3 ) return EOF; while ( ( count = getblock( fp, buf ) ) != 0 && count != EOF ) { buf[ count ] = '0円'; - M_info( 0, buf ); + M_info( __func__, buf ); } break; default : - M_err( f, "%s: Bogus extension byte 0x%02x", im->infile, label ); + M_err( __func__, "%s: Bogus extension byte 0x%02x", + im->infile, label ); break; } @@ -548,8 +549,7 @@ skip_extension( FILE * fp, break; default : - M_warn( "GIFextension", "%s: Bogus byte 0x%02x", - im->infile, pchar ); + M_warn( __func__, "%s: Bogus byte 0x%02x", im->infile, pchar ); return EOF; } } @@ -587,7 +587,6 @@ GIF_load( FL_IMAGE * im ) unsigned char *ch, buf[ 257 ]; SPEC *sp = im->io_spec; - const char *func = "GIFReadPix"; FILE *fp = im->fpin; sp->ctext = 0; @@ -651,7 +650,7 @@ GIF_load( FL_IMAGE * im ) && fread( buf, 1, 50, fp ) && getc( fp ) != EOF ) { - M_info( func, "%s: Garbage(> 50bytes) at end", im->infile ); + M_info( __func__, "%s: Garbage(> 50bytes) at end", im->infile ); } } @@ -664,7 +663,7 @@ GIF_load( FL_IMAGE * im ) int leftover; leftover = lbuf - lhead; - M_warn( func, "total %ld should be %d", sp->cur_total + leftover, + M_warn( __func__, "total %ld should be %d", sp->cur_total + leftover, im->w * im->h ); if ( leftover ) @@ -1102,13 +1101,13 @@ write_desc( FL_IMAGE * im, if ( bpp < 1 || bpp > 8 ) { - M_err( "GIF_dump", "%s: Bad bpp=%d", im->outfile, bpp ); + M_err( __func__, "%s: Bad bpp=%d", im->outfile, bpp ); bpp = 1; } if ( Badfwrite("GIF89a", 1, 6, ffp ) ) { - M_err( "GIF_dump", im->outfile ); + M_err( __func__, im->outfile ); return -1; } diff --git a/image/image_io_filter.c b/image/image_io_filter.c index d994d55..fda2177 100644 --- a/image/image_io_filter.c +++ b/image/image_io_filter.c @@ -124,7 +124,7 @@ flimage_description_via_filter( FL_IMAGE * im, if ( status ) { - M_err( "", "%s failed", cmd ); + M_err( __func__, "%s failed", cmd ); return -1; } diff --git a/image/image_marker.c b/image/image_marker.c index 56d0c6f..da9c971 100644 --- a/image/image_marker.c +++ b/image/image_marker.c @@ -170,7 +170,7 @@ flimage_add_marker( FL_IMAGE * im, if ( ! im ) { - M_err( "AddMarker", "Bad image" ); + M_err( __func__, "Bad image" ); return -1; } @@ -225,7 +225,7 @@ flimage_add_marker_struct( FL_IMAGE * im, if ( ! min->name || ! ( m = get_marker( min->name ) ) ) { - M_err( "AddMarker", "bad marker name: %s", min->name ); + M_err( __func__, "bad marker name: %s", min->name ); return -1; } diff --git a/image/image_postscript.c b/image/image_postscript.c index 5e0b1d0..62018b2 100644 --- a/image/image_postscript.c +++ b/image/image_postscript.c @@ -149,11 +149,11 @@ load_page( FL_IMAGE * im, sp->tmpdir, sp->prefix, pageNo ); if ( sp->verbose ) - M_err( "LoadPage", "loading %s", name ); + M_err( __func__, "loading %s", name ); if ( ! ( n = flimage_is_supported( name ) ) ) { - M_err( "LoadPage", "internal error. %s unknown", name ); + M_err( __func__, "internal error. %s unknown", name ); return -1; } @@ -203,7 +203,7 @@ PS_cleanup( FL_IMAGE * im ) fli_snprintf( name, sizeof name, "%s/%s_%d", sp->tmpdir, sp->prefix, i ); if ( sp->verbose ) - M_err( "Cleanup", "deleting %s", name ); + M_err( __func__, "deleting %s", name ); remove( name ); } @@ -237,7 +237,7 @@ PS_read_pixels( FL_IMAGE * im ) sp->prefix = fl_strdup( prefix ); if ( sp->verbose ) - M_err( "LoadPS", "prefix=%s", sp->prefix ); + M_err( __func__, "prefix=%s", sp->prefix ); fli_snprintf( cmd, sizeof cmd, "gs -sDEVICE=%s %s -r%dx%d -sOutputFile=%s/%s_%%d -- %s %s", @@ -247,7 +247,7 @@ PS_read_pixels( FL_IMAGE * im ) "/showpage { systemdict begin showpage quit end} def" : "" ); if ( sp->verbose ) - M_err( "LoadPS", "executing %s\n", cmd ); + M_err( __func__, "executing %s\n", cmd ); else strcat( cmd, " 2 > /dev/null" ); @@ -256,7 +256,7 @@ PS_read_pixels( FL_IMAGE * im ) if ( ( status = system( cmd ) ) ) { - M_err( "ReadPS", " status=%d", status ); + M_err( __func__, " status=%d", status ); flimage_error( im, "ReadPS failed. Status=%d", status ); return -1; } @@ -289,7 +289,7 @@ PS_read_pixels( FL_IMAGE * im ) fl_free_dirlist( dirlist ); if ( sp->verbose ) - M_err( "LoadPS", "Total %d pages", npages ); + M_err( __func__, "Total %d pages", npages ); if ( npages <= 0 ) { diff --git a/image/image_proc.c b/image/image_proc.c index 017f2a9..70126ce 100644 --- a/image/image_proc.c +++ b/image/image_proc.c @@ -261,14 +261,14 @@ make_submatrix( void * in, if (r1 < 0 || c1 < 0 || (r1 + rs - 1) >= rows || (c1 + cs - 1) >= cols) { - M_err("make_submatrix", "Bad arguments"); + M_err( __func__, "Bad arguments" ); return 0; } if ( mat[ -1 ] != ( char * ) FL_GET_MATRIX && mat[ -1 ] != ( char * ) FL_MAKE_MATRIX ) { - M_err( "make_submatrix", "input is not a matrix" ); + M_err( __func__, "input is not a matrix" ); return NULL; } @@ -301,14 +301,14 @@ get_submatrix( void * in, if ( r1 < 0 || c1 < 0 || r1 + rs - 1 >= rows || c1 + cs - 1 >= cols ) { - M_err("get_submatrix", "Bad arguments"); + M_err( __func__, "Bad arguments" ); return 0; } if ( mat[ -1 ] != ( char * ) FL_GET_MATRIX && mat[ -1 ] != ( char * ) FL_MAKE_MATRIX ) { - M_err( "get_submatrix", "input is not a matrix" ); + M_err( __func__, "input is not a matrix" ); return NULL; } diff --git a/image/image_replace.c b/image/image_replace.c index df82ea9..d883231 100644 --- a/image/image_replace.c +++ b/image/image_replace.c @@ -106,7 +106,7 @@ flimage_replace_pixel( FL_IMAGE * im, } else { - M_err( "ReplaceColor", "InternalError: bad type %d", im->type ); + M_err( __func__, "InternalError: bad type %d", im->type ); return -1; } diff --git a/image/image_rotate.c b/image/image_rotate.c index 8bbf164..d162325 100644 --- a/image/image_rotate.c +++ b/image/image_rotate.c @@ -92,8 +92,7 @@ flimage_rotate( FL_IMAGE * im, r = rotate_matrix( im->ci, im->h, im->w, deg, sizeof **im->ci ); else { - M_err( "flimage_rotate", "InternalError: unsupported image " - "type\n" ); + M_err( __func__, "InternalError: unsupported image type" ); return -1; } @@ -345,7 +344,7 @@ rotate_matrix( void * m, } else { - M_err( "RotateMatrix", "InternalError: bad special angle\n" ); + M_err( __func__, "InternalError: bad special angle" ); return 0; } diff --git a/image/image_tiff.c b/image/image_tiff.c index 1ca6958..c58aac5 100644 --- a/image/image_tiff.c +++ b/image/image_tiff.c @@ -200,7 +200,7 @@ TIFF_next( FL_IMAGE * im ) if ( get_image_info_from_ifd( im ) < 0 ) { flimage_error( im, "Can't get image info" ); - M_err( "Next", "Can't get image info" ); + M_err( __func__, "Can't get image info" ); return -1; } @@ -577,7 +577,7 @@ read_tag( FILE * fp, || ( nbyte = count * typeSize[ type ] ) <= 0 ) { flimage_error( sp->image, "BadType (%d) or count (%d)\n", type, count ); - M_err( "ReadTag", "BadType (%d) or count (%d)\n", type, count ); + M_err( __func__, "BadType (%d) or count (%d)\n", type, count ); return; } @@ -646,7 +646,7 @@ read_tiff_ifd( FILE * fp, && tag->value[ 0 ] != 8 && tag->value[ 0 ] != 16 ) { - M_err( "ReadIFD", "Unsupported bitsPerSample %d", tag->value[ 0 ] ); + M_err( __func__, "Unsupported bitsPerSample %d", tag->value[ 0 ] ); return -1; } @@ -775,7 +775,7 @@ read_pixels( FL_IMAGE * im ) bytecount = bytecountTag->value[ strip ]; if ( ( err = ( fread( tmpbuffer, 1, bytecount, fp ) == 0 ) ) ) - M_err( "ReadStrip", "Error reading ByteCount" ); + M_err( __func__, "Error reading ByteCount" ); /* TODO: de-compress the tmpbuffer */ @@ -832,7 +832,7 @@ read_pixels( FL_IMAGE * im ) } else { - M_err( "ReadStrip", "Unhandled bpp=%d\n", sp->bps[ 0 ] ); + M_err( __func__, "Unhandled bpp=%d\n", sp->bps[ 0 ] ); return -1; } } @@ -870,7 +870,7 @@ read_pixels( FL_IMAGE * im ) } else { - M_err( "ReadRGB", "Unknown PlannarConfig %d", config ); + M_err( __func__, "Unknown PlannarConfig %d", config ); return -1; } } @@ -1111,7 +1111,7 @@ write_ifd( FL_IMAGE * im, if ( num_tags > sp->max_tags ) { - M_err( "WriteTIFFIFD", "InternalError: run out of tag space" ); + M_err( __func__, "InternalError: run out of tag space" ); return -1; } @@ -1160,7 +1160,7 @@ write_ifd( FL_IMAGE * im, if ( itag != num_tags ) { - M_err( "WriteTIFFIFD", "wrong number of tags. wrote %d expect %d", + M_err( __func__, "wrong number of tags. wrote %d expect %d", itag, num_tags ); return -1; } diff --git a/image/image_type.c b/image/image_type.c index 98062b5..29a2dbd 100644 --- a/image/image_type.c +++ b/image/image_type.c @@ -63,8 +63,7 @@ spline_int_interpolate( const int * wx, if ( nin <= 3 ) { - M_warn( "fl_spline_int_interpolate", - "too few points (less than 4) for interpolation" ); + M_warn( __func__, "too few points (less than 4) for interpolation" ); return -1; } diff --git a/image/image_warp.c b/image/image_warp.c index faddf16..7418511 100644 --- a/image/image_warp.c +++ b/image/image_warp.c @@ -199,7 +199,7 @@ interpol2d_uc( int out[ 3 ], || out[ 1 ] < 0 || out[ 1 ] > FL_PCMAX || out[ 2 ] < 0 || out[ 2 ] > FL_PCMAX) { - M_err( "interpol2D", "out of range" ); + M_err( __func__, "out of range" ); exit( 1 ); } @@ -565,7 +565,7 @@ flimage_warp( FL_IMAGE * im, } else { - M_err( "Transform", "InternalError. Bad type" ); + M_err( __func__, "InternalError. Bad type" ); return -1; } diff --git a/image/image_xwd.c b/image/image_xwd.c index 05bc3d2..820b6e7 100644 --- a/image/image_xwd.c +++ b/image/image_xwd.c @@ -213,7 +213,7 @@ XWD_description( FL_IMAGE * im ) im->spec_size = sizeof *sp; if ( fread( header, 1, sizeof *header, fp ) != sizeof *header ) - M_err( "ImageXWD", "failure to read from file" ); + M_err( __func__, "failure to read from file" ); if ( ( sp->swap = need_swap ) ) swap_header( header ); @@ -262,7 +262,7 @@ XWD_description( FL_IMAGE * im ) { im->type = FL_IMAGE_CI; if ( header->ncolors == 0 ) - M_err( "ImageXWD", "no colormap ?" ); + M_err( __func__, "no colormap ?" ); } im->w = header->pixmap_width; @@ -475,7 +475,7 @@ XWD_read_pixels( FL_IMAGE * im ) if ( fread( uc, 1, h->bytes_per_line, fp ) != h->bytes_per_line ) { - M_err( "LoadXWD", "failure to read from file" ); + M_err( __func__, "failure to read from file" ); err = 1; break; } @@ -487,7 +487,7 @@ XWD_read_pixels( FL_IMAGE * im ) break; default: - M_err( "LoadXWD", "%d bpp not implemented\n", h->bits_per_pixel ); + M_err( __func__, "%d bpp not implemented\n", h->bits_per_pixel ); err = 1; break; } diff --git a/image/postscript.c b/image/postscript.c index b44ec5b..2378a30 100644 --- a/image/postscript.c +++ b/image/postscript.c @@ -161,7 +161,7 @@ fl_object_ps_dump( FL_OBJECT * ob, if ( ! *fname ) { - M_err( "PS_dump", "null filename" ); + M_err( __func__, "null filename" ); return -1; } @@ -172,7 +172,7 @@ fl_object_ps_dump( FL_OBJECT * ob, if ( ! flps->fp ) { - M_err( "PS_dump", "can't open %s", fname ); + M_err( __func__, "can't open %s", fname ); return -1; } @@ -260,7 +260,7 @@ fl_object_ps_dump( FL_OBJECT * ob, break; default : - M_err( "PS_dump", "unsupported object class: %d", ob->objclass ); + M_err( __func__, "unsupported object class: %d", ob->objclass ); break; } @@ -784,7 +784,7 @@ ps_draw_xyplot( FL_OBJECT * ob ) if ( ! ob->visible || ! ob->form->visible ) { - M_err( "PSDrawXYPlot", "object must be visible" ); + M_err( __func__, "object must be visible" ); return; } diff --git a/lib/align.c b/lib/align.c index 4c80c68..8a84af3 100644 --- a/lib/align.c +++ b/lib/align.c @@ -45,7 +45,7 @@ fli_test_lalign( int align, || ( ( unsigned int ) align & ~ FL_ALIGN_INSIDE ) > FL_ALIGN_RIGHT_BOTTOM ) { - M_err( txt, "Invalid value for align" ); + M_err( __func__, "Invalid value for align for \"%s\"", txt ); return 0; } @@ -172,7 +172,7 @@ fli_get_hv_align( int align, break; default : - M_err( "fli_get_hv_align", "Bad request: %d\n", align ); + M_err( __func__, "Bad request: %d\n", align ); *halign = FL_ALIGN_CENTER; *valign = FL_ALIGN_CENTER; break; diff --git a/lib/appwin.c b/lib/appwin.c index b307c21..273833e 100644 --- a/lib/appwin.c +++ b/lib/appwin.c @@ -57,7 +57,7 @@ static void remove_app_win( FLI_WIN * appwin ) { #if FL_DEBUG >= ML_DEBUG - M_info( "remove_app_win", "deleting window %ld", appwin->win ); + M_info( __func__, "deleting window %ld", appwin->win ); #endif if ( fli_app_win == appwin ) @@ -73,7 +73,7 @@ remove_app_win( FLI_WIN * appwin ) fwin->next = fwin->next->next; else { - M_err( "remove_app_win", "Invalid argument" ); + M_err( __func__, "Invalid argument" ); return; } } @@ -104,7 +104,7 @@ get_fl_win_struct( Window win ) /* Otherwise create a new structure and append it to the end */ #if FL_DEBUG >= ML_DEBUG - M_info( "get_fl_win_struct", "Creating FLI_WIN struct for %ld", win ); + M_info( __func__, "Creating FLI_WIN struct for %ld", win ); #endif if ( ( fwin = fl_malloc( sizeof *fwin ) ) == NULL ) @@ -149,7 +149,7 @@ fli_set_preemptive_callback( Window win, if ( ! ( fwin = get_fl_win_struct( win ) ) ) { - M_err( "fli_set_preemptive_callback", "Memory allocation failure" ); + M_err( __func__, "Memory allocation failure" ); return NULL; } @@ -182,7 +182,7 @@ fl_add_event_callback( Window win, if ( ! ( fwin = get_fl_win_struct( win ) ) ) { - M_err( "fl_add_event_callback", "Memory allocation failure" ); + M_err( __func__, "Memory allocation failure" ); return NULL; } @@ -318,7 +318,7 @@ fl_activate_event_callbacks( Window win ) if ( ! fwin ) { - M_err( "fl_activate_event_callbacks", "Unknown window %ld", win ); + M_err( __func__, "Unknown window %ld", win ); return; } diff --git a/lib/asyn_io.c b/lib/asyn_io.c index f70b364..dabc667 100644 --- a/lib/asyn_io.c +++ b/lib/asyn_io.c @@ -84,7 +84,7 @@ collect_fds( void ) { if ( p->source < 0 ) { - M_err( "collect_fds", "source < 0\n" ); + M_err( __func__, "source < 0\n" ); continue; } @@ -148,7 +148,7 @@ fl_remove_io_callback( int fd, if ( ! io ) { - M_err( "fl_remove_io_callback", "Non-existent handler for %d", fd ); + M_err( __func__, "Non-existent handler for %d", fd ); return; } @@ -223,12 +223,12 @@ fli_watch_io( FLI_IO_REC * io_rec, if ( nf < 0 ) /* something is wrong. */ { if ( errno == EINTR ) - M_warn( "fli_watch_io", "select interrupted by signal" ); + M_warn( __func__, "select interrupted by signal" ); /* select() on some platforms returns -1 with errno == 0 */ else if ( errno != 0 ) - M_err( "fli_watch_io", fli_get_syserror_msg( ) ); + M_err( __func__, fli_get_syserror_msg( ) ); return; } diff --git a/lib/bitmap.c b/lib/bitmap.c index f80d0c0..37669db 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -267,7 +267,7 @@ fl_set_bitmap_data( FL_OBJECT * obj, if ( p == None ) { - M_err( "fl_set_bitmap_data", "Can't create bitmap" ); + M_err( __func__, "Can't create bitmap" ); return; } @@ -297,7 +297,7 @@ fl_read_bitmapfile( Window win, w, h, &p, hotx, hoty ); if ( status != BitmapSuccess ) - M_err( "fl_read_bitmapfile", "%s: %s", file, + M_err( __func__, "%s: %s", file, status == BitmapFileInvalid ? "Invalid file" : "Can't read" ); return p; } @@ -322,7 +322,7 @@ fl_set_bitmap_file( FL_OBJECT * obj, if ( ! obj || ( obj->objclass != FL_BITMAP && obj->objclass != FL_BITMAPBUTTON ) ) { - M_err( "fl_set_bitmap_file", "object %s not bitmap or bitmap button", + M_err( __func__, "object %s not bitmap or bitmap button", ( obj && obj->label ) ? obj->label : "null" ); return; } diff --git a/lib/button.c b/lib/button.c index 7bcc44f..3e5df74 100644 --- a/lib/button.c +++ b/lib/button.c @@ -229,7 +229,7 @@ fl_add_button_class( int bclass, first_avail->cleanup = cleanup; } else - M_err( "fl_add_button_class", "Exceeding limit: %d", MAX_BUTTON_CLASS ); + M_err( __func__, "Exceeding limit: %d", MAX_BUTTON_CLASS ); } @@ -281,7 +281,7 @@ handle_button( FL_OBJECT * obj, if ( ( drawit = lookup_drawfunc( obj->objclass ) ) ) drawit( obj ); else - M_err( "handle_button", "Unknown button class: %d", + M_err( __func__, "Unknown button class: %d", obj->objclass ); } break; @@ -651,7 +651,7 @@ fl_get_button_mouse_buttons( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_get_button_mouse_buttons", "NULL object" ); + M_err( __func__, "NULL object" ); return; } diff --git a/lib/canvas.c b/lib/canvas.c index 265d219..eccf32d 100644 --- a/lib/canvas.c +++ b/lib/canvas.c @@ -168,7 +168,7 @@ fl_get_canvas_id( FL_OBJECT * ob ) #if FL_DEBUG >= ML_DEBUG if ( ! IsValidCanvas( ob ) ) { - M_err( "fl_get_canvas_id", "%s not a canvas", + M_err( __func__, "object %s not a canvas", ( ob && ob->label ) ? ob->label : "" ); return None; } @@ -195,7 +195,7 @@ BegWMColormap( FLI_CANVAS_SPEC * sp ) if ( sp->colormap != fli_colormap( fl_vmode ) && ! XSetWMColormapWindows( flx->display, sp->parent, &sp->window, 1 ) ) - M_err( "BegWMColormap", "WM choked" ); + M_err( __func__, "WM choked" ); } @@ -214,7 +214,7 @@ fl_set_canvas_attributes( FL_OBJECT * ob, if ( mask & CWEventMask ) { - M_err( "fl_set_canvas_attributes", "Changing Events not supported" ); + M_err( __func__, "Changing Events not supported" ); mask &= ~ CWEventMask; } @@ -248,8 +248,7 @@ fl_set_canvas_colormap( FL_OBJECT * ob, if ( sp->window ) { - M_warn( "fl_set_canvas_colormap", - "Changing colormap for active window" ); + M_warn( __func__, "Changing colormap for active window" ); XChangeWindowAttributes( flx->display, sp->window, sp->mask, &sp->xswa ); BegWMColormap( sp ); @@ -336,13 +335,13 @@ init_canvas( FL_OBJECT * ob ) if ( sp->parent == None ) { - M_err( "init_canvas", "Internal Error" ); + M_err( __func__, "Internal Error" ); exit( 0 ); } if ( sp->init && sp->init( ob ) < 0 ) { - M_err( "init_canvas", "Unable to initialize canvas %s", ob->label ); + M_err( __func__, "Unable to initialize canvas %s", ob->label ); return; } @@ -358,7 +357,7 @@ init_canvas( FL_OBJECT * ob ) sp->user_mask, &sp->user_xswa ); #if FL_DEBUG >= ML_ERR - M_warn( "init_canvas", "Depth = %d colormap = 0x%lx, WinID = %ld", + M_warn( __func__, "Depth = %d colormap = 0x%lx, WinID = %ld", sp->depth, sp->colormap, sp->window ); #endif @@ -368,7 +367,7 @@ init_canvas( FL_OBJECT * ob ) if ( sp->activate && sp->activate( ob ) < 0 ) { - M_err( "init_canvas", "Can't initialize canvas %s", ob->label ); + M_err( __func__, "Can't initialize canvas %s", ob->label ); return; } @@ -398,7 +397,7 @@ init_canvas( FL_OBJECT * ob ) if ( Moved( ob, sp ) || Resized( ob, sp ) ) { - M_warn( "init_canvas", "Canvas: WinMoved\n" ); + M_warn( __func__, "Canvas: WinMoved\n" ); XMoveResizeWindow( flx->display, sp->window, ob->x, ob->y, ob->w, ob->h ); } @@ -431,14 +430,14 @@ fl_add_canvas_handler( FL_OBJECT * ob, if ( ! IsValidCanvas( ob ) ) { - M_err( "fl_add_canvas_handler", "%s not canvas class", + M_err( __func__, "%s not canvas class", ob ? ob->label : "" ); return NULL; } if ( ev < KeyPress ) { - M_err( "fl_add_canvas_handler", "Invalid event %d", ev ); + M_err( __func__, "Invalid event %d", ev ); return NULL; } @@ -472,7 +471,7 @@ fl_remove_canvas_handler( FL_OBJECT * ob, if ( ev < 0 || ev >= LASTEvent ) { - M_err( "fl_remove_canvas_handler", "Invalid event %d", ev ); + M_err( __func__, "Invalid event %d", ev ); return; } diff --git a/lib/chart.c b/lib/chart.c index ca69966..ec1f0b9 100644 --- a/lib/chart.c +++ b/lib/chart.c @@ -563,7 +563,7 @@ handle_chart( FL_OBJECT * ob, void * ev FL_UNUSED_ARG ) { #if FL_DEBUG >= ML_DEBUG - M_info( "handle_chart", fli_event_name( event ) ); + M_info( __func__, fli_event_name( event ) ); #endif switch ( event ) @@ -724,7 +724,7 @@ fl_add_chart_value( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHART ) ) { - M_err( "fl_add_chart_value", "%s not a chart", ob ? ob->label : "" ); + M_err( __func__, "%s not a chart", ob ? ob->label : "" ); return; } #endif @@ -773,7 +773,7 @@ fl_insert_chart_value( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHART ) ) { - M_err( "fl_insert_chart_value", "%s not a chart", ob ? ob->label : "" ); + M_err( __func__, "%s not a chart", ob ? ob->label : "" ); return; } #endif @@ -845,7 +845,7 @@ fl_set_chart_bounds( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHART ) ) { - M_err( "fl_set_chart_bounds", "%s not a chart", ob ? ob->label : "" ); + M_err( __func__, "%s not a chart", ob ? ob->label : "" ); return; } #endif @@ -890,7 +890,7 @@ fl_set_chart_maxnumb( FL_OBJECT * ob, if ( maxnumb < 0 ) { - M_err( "fl_set_chart_maxnum", "Invalid maxnumb value" ); + M_err( __func__, "Invalid maxnumb value" ); return; } diff --git a/lib/child.c b/lib/child.c index 1da8915..1fc95db 100644 --- a/lib/child.c +++ b/lib/child.c @@ -287,13 +287,13 @@ fli_insert_composite_after( FL_OBJECT * obj, if ( ! obj || ! after ) { - M_err( "fli_insert_composite_after", "Bad argument" ); + M_err( __func__, "Bad argument" ); return; } if ( ! ( form = after->form ) ) { - M_err( "fli_insert_composite_after", "Null form" ); + M_err( __func__, "Null form" ); return; } @@ -342,7 +342,7 @@ fl_get_object_component( FL_OBJECT * composite, return tmp; } - M_err( "fl_get_object_component", "Requested object not found" ); + M_err( __func__, "Requested object not found" ); return NULL; } diff --git a/lib/choice.c b/lib/choice.c index 6a836ba..8678ab6 100644 --- a/lib/choice.c +++ b/lib/choice.c @@ -228,7 +228,7 @@ set_next_entry( FLI_CHOICE_SPEC * sp, if ( ! ( sp->mode[ target ] & FL_PUP_GREY ) ) return sp->val = target; - M_err( "set_next_entry", "No valid entries" ); + M_err( __func__, "No valid entries" ); return -1; } @@ -319,7 +319,7 @@ handle_choice( FL_OBJECT * ob, int ret = FL_RETURN_NONE; #if FL_DEBUG >= ML_DEBUG - M_info2( "handle_choice", fli_event_name( event ) ); + M_info2( __func__, fli_event_name( event ) ); #endif switch ( event ) @@ -559,8 +559,7 @@ fl_clear_choice( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHOICE ) ) { - M_err( "fl_clear_choice", "%s is not choice class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not choice class", ob ? ob->label : "" ); return; } #endif @@ -616,8 +615,7 @@ fl_addto_choice( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHOICE ) ) { - M_err( "fl_addto_choice", "%s is not choice class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not choice class", ob ? ob->label : "" ); return 0; } #endif @@ -773,8 +771,7 @@ fl_set_choice_text( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHOICE ) ) { - M_err( "fl_set_choice_text", "%s not choice class", - ob ? ob->label : "" ); + M_err( __func__, "object %s not choice class", ob ? ob->label : "" ); return; } #endif @@ -787,7 +784,7 @@ fl_set_choice_text( FL_OBJECT * ob, return; } - M_err( "fl_set_choice_text", "%s not found", txt ); + M_err( __func__, "choice object with \"%s\" not found", txt ); } @@ -818,7 +815,7 @@ fl_get_choice_item_mode( FL_OBJECT * ob, if ( item < 1 || item > sp->numitems ) { - M_err( "fl_get_choice_item_mode", "Bad item index %d", item ); + M_err( __func__, "Bad item index %d", item ); return -1; } @@ -840,7 +837,7 @@ fl_set_choice_item_mode( FL_OBJECT * ob, if ( item < 1 || item > sp->numitems ) { - M_err( "fl_set_choice_item_mode", "Bad item index %d", item ); + M_err( __func__, "Bad item index %d", item ); return; } @@ -861,7 +858,7 @@ fl_set_choice_item_shortcut( FL_OBJECT * ob, if ( item < 1 || item > sp->numitems ) { - M_err( "fl_set_choice_item_shortcut", "Bad item index %d", item ); + M_err( __func__, "Bad item index %d", item ); return; } @@ -882,7 +879,7 @@ fl_get_choice( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHOICE ) ) { - M_err( "fl_get_choice", "%s is not choice class", ob ? ob->label : "" ); + M_err( __func__, "%s is not choice class", ob ? ob->label : "" ); return 0; } #endif @@ -913,8 +910,7 @@ fl_get_choice_text( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_CHOICE ) ) { - M_err( "fl_get_choice_text", "%s is not choice class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not a choice", ob ? ob->label : "" ); return 0; } #endif @@ -953,7 +949,7 @@ fl_set_choice_fontsize( FL_OBJECT * ob, if ( size < 1 ) { - M_err( "fl_set_choice_fontsize", "Invalid font size (%d)", size ); + M_err( __func__, "Invalid font size (%d)", size ); return; } diff --git a/lib/clipboard.c b/lib/clipboard.c index a36dca6..ca840cf 100644 --- a/lib/clipboard.c +++ b/lib/clipboard.c @@ -70,7 +70,7 @@ fl_stuff_clipboard( FL_OBJECT * ob, if ( ! win ) { - M_err( "fl_stuff_clipboard", "Bad object %s", ob ? ob->label : "null" ); + M_err( __func__, "Bad object %s", ob ? ob->label : "null" ); return 0; } @@ -80,7 +80,7 @@ fl_stuff_clipboard( FL_OBJECT * ob, if ( XGetSelectionOwner( flx->display, XA_PRIMARY ) != win ) { - M_err( "fl_stuff_clipboard", "Failed to get owner" ); + M_err( __func__, "Failed to get owner" ); return 0; } @@ -118,7 +118,7 @@ fl_request_clipboard( FL_OBJECT * ob, if ( got_it_callback == NULL ) { - M_warn( "fl_request_clipboard", "Callback is NULL" ); + M_warn( __func__, "Callback is NULL" ); return -1; } @@ -148,7 +148,7 @@ fl_request_clipboard( FL_OBJECT * ob, { /* We don't own it, request it */ - M_warn( "fl_request_clipboard", "Requesting selection from %ld", win ); + M_warn( __func__, "Requesting selection from %ld", win ); XConvertSelection( flx->display, XA_PRIMARY, XA_STRING, clipboard_prop, @@ -193,7 +193,7 @@ handle_clipboard_event( void * event ) if ( ! cp->req_window && ! cp->window ) { - M_warn( "handle_clipboard_event", "InternalError" ); + M_warn( __func__, "InternalError" ); return -1; } @@ -265,11 +265,11 @@ handle_clipboard_event( void * event ) { /* Someone wants our selection */ - M_warn( "handle_clipboard_event", "SelectionRequest" ); + M_warn( __func__, "SelectionRequest" ); if ( sreq->owner != cp->window ) { - M_err( "handle_clipboard_event", "Wrong owner" ); + M_err( __func__, "Wrong owner" ); return -1; } @@ -309,8 +309,8 @@ handle_clipboard_event( void * event ) /* If we have other types conversion routine should be called here */ - M_warn( "handle_clipboard_event", "Received request with " - "unknown/not implemented XAtom target type: %d\n", + M_warn( __func__, "Received request with unknown/not " + "implemented XAtom target type: %d\n", ( int ) sreq->target ); } @@ -321,7 +321,7 @@ handle_clipboard_event( void * event ) { /* not XA_PRIMARY request */ - M_warn( "handle_clipboard_event", "Unknown selection request: %d", + M_warn( __func__, "Unknown selection request: %d", sreq->selection ); return -1; } diff --git a/lib/cmd_br.c b/lib/cmd_br.c index 6d508c7..b4cb9c5 100644 --- a/lib/cmd_br.c +++ b/lib/cmd_br.c @@ -85,7 +85,7 @@ io_cb( int fd, else if ( n <= 0 ) { /* 0: EOF <0: error. */ if ( n < 0 ) - M_err( "io_cb", "read returns %d", n ); + M_err( __func__, "read returns %d", n ); fl_remove_io_callback( fd, FL_READ, io_cb ); close( fd ); } @@ -99,7 +99,7 @@ io_cb( int fd, else if ( n <= 0 ) { /* 0: EOF <0: error. */ if ( n < 0 ) - M_err( "io_cb", "read returns %d", n ); + M_err( __func__, "read returns %d", n ); fl_remove_io_callback( fd, FL_READ, io_cb ); CloseHandle( ( HANDLE ) fd ); } diff --git a/lib/counter.c b/lib/counter.c index 0ea5c57..d1c7359 100644 --- a/lib/counter.c +++ b/lib/counter.c @@ -226,7 +226,7 @@ void fl_set_counter_repeat( FL_OBJECT * ob, { if ( millisec <= 0 ) { - M_warn( "fl_set_counter_repeat", "Invalid argument, disregarded" ); + M_warn( __func__, "Invalid argument, disregarded" ); return; } @@ -251,7 +251,7 @@ void fl_set_counter_min_repeat( FL_OBJECT * ob, { if ( millisec <= 0 ) { - M_warn( "fl_set_counter_min_repeat", "Invalid argument, disregarded" ); + M_warn( __func__, "Invalid argument, disregarded" ); return; } @@ -579,8 +579,7 @@ fl_set_counter_value( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_COUNTER ) ) { - M_err( "fl_set_counter_value", "%s not a counter", - ob ? ob->label : "" ); + M_err( __func__, "object %s not a counter", ob ? ob->label : "" ); return; } #endif @@ -623,8 +622,7 @@ fl_set_counter_bounds( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_COUNTER ) ) { - M_err( "fl_set_counter_bounds", "%s not a counter", - ob ? ob->label : "" ); + M_err( __func__, "object %s not a counter", ob ? ob->label : "" ); return; } #endif @@ -714,8 +712,7 @@ fl_get_counter_value( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_COUNTER ) ) { - M_err( "fl_get_counter_value", "%s not a counter", - ob ? ob->label : "" ); + M_err( __func__, "object %s not a counter", ob ? ob->label : "" ); return 0; } #endif diff --git a/lib/cursor.c b/lib/cursor.c index 002af10..406f20d 100644 --- a/lib/cursor.c +++ b/lib/cursor.c @@ -101,7 +101,7 @@ add_cursor( int name, } else if ( ! warned ) { - M_err( "add_cursor", "too many cursors" ); + M_err( __func__, "too many cursors" ); warned = 1; } return c; @@ -214,7 +214,7 @@ fl_set_cursor( Window win, if ( win == 0 ) { - M_err( "fl_set_cursor", "Bad Window" ); + M_err( __func__, "Bad Window" ); return; } @@ -288,7 +288,7 @@ fli_get_cursor_byname( int name ) } else { - M_err( "fli_get_cursor_byname", "Unknown cursor: %d\n", name ); + M_err( __func__, "Unknown cursor: %d\n", name ); cur = fli_get_cursor_byname( FL_DEFAULT_CURSOR ); /* recursion */ } @@ -186,7 +186,7 @@ draw_dial( FL_OBJECT * obj ) fl_circ( x, y, iradius, FL_BLACK ); } else - M_err( "draw_dial", "Bad type" ); + M_err( __func__, "Bad type" ); fl_draw_text_beside( obj->align, obj->x, obj->y, obj->w, obj->h, obj->lcol, obj->lstyle, obj->lsize, obj->label ); diff --git a/lib/events.c b/lib/events.c index 744d081..ace5e09 100644 --- a/lib/events.c +++ b/lib/events.c @@ -70,8 +70,7 @@ fli_handle_event_callbacks( XEvent * xev ) if ( fli_event_callback && ! fli_event_callback( xev, fli_user_data ) ) return 1; - M_warn( "fli_handle_event_callbacks", "Unknown window = %ld", - xev->xany.window ); + M_warn( __func__, "Unknown window = %ld", xev->xany.window ); fli_xevent_name( "Ignored", xev ); return 1; } @@ -332,7 +331,7 @@ fli_object_qenter( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fli_object_qenter", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -341,7 +340,7 @@ fli_object_qenter( FL_OBJECT * obj, && ( ! obj->form || ! obj->visible || obj->active <= 0 ) ) { #if FL_DEBUG >= ML_DEBUG - M_err( "fli_object_qenter", "Bad object" ); + M_err( __func__, "Bad object" ); #endif return; } @@ -719,7 +718,7 @@ fl_XPutBackEvent( XEvent * xev ) { if ( ++mm % 20 == 0 ) { - M_warn( "fl_XPutbackEvent", "20 NoExpose discarded" ); + M_warn( __func__, "20 NoExpose discarded" ); mm = 0; } @@ -979,7 +978,7 @@ badwin_handler( Display * dpy FL_UNUSED_ARG, XErrorEvent * xev ) { if ( xev->type != BadWindow && xev->type != BadDrawable ) - M_err( "badwin_handler", + M_err( __func__, "X error happened when expecting only BadWindow/Drawable\n" ); return 0; } @@ -1087,7 +1086,7 @@ compress_motion( XEvent * xme ) do { #if FL_DEBUG >= ML_DEBUG - M_info2( "compress_motion", "win = %ld (%d, %d) %s", + M_info2( __func__, "win = %ld (%d, %d) %s", xme->xany.window, xme->xmotion.x, xme->xmotion.y, xme->xmotion.is_hint ? "hint" : "" ) #endif @@ -1138,7 +1137,7 @@ fl_keysym_pressed( KeySym k ) if ( ( code = XKeysymToKeycode( flx->display, k ) ) == NoSymbol ) { - M_warn( "fl_keysym_pressed", "Bad KeySym %d", ( int ) k ); + M_warn( __func__, "Bad KeySym %d", ( int ) k ); return 0; } diff --git a/lib/flcolor.c b/lib/flcolor.c index cffd9a2..62b6d4d 100644 --- a/lib/flcolor.c +++ b/lib/flcolor.c @@ -290,7 +290,7 @@ fli_query_namedcolor( const char *s ) if ( ! s ) { - M_err( "fli_query_namedcolor", "Null pointer for color name" ); + M_err( __func__, "Null pointer for color name" ); return FL_MAX_COLORS + 1; } @@ -332,14 +332,14 @@ fl_set_gamma( double r, { /* Too lazy to shuffle colormap around */ - M_err( "fl_set_gamma", + M_err( __func__, "Ignored. Please call fl_set_gamma before fl_initialize()" ); return; } if ( r <= 1.e-3 || g <= 1.e-3 || b <= 1.e-3 ) { - M_warn( "fl_set_gamma", "BadValue %4.2f %4.2f %4.2f. Ignored", + M_warn( __func__, "BadValue %4.2f %4.2f %4.2f. Ignored", r, g, b ); return; } @@ -419,7 +419,7 @@ be_nice( void ) { XColor xc; - M_warn( "be_nice", "Black = %ld White = %ld", black, white ); + M_warn( __func__, "Black = %ld White = %ld", black, white ); /* As a minimum, we should preserve black & white */ @@ -429,33 +429,33 @@ be_nice( void ) xc.red = xc.green = xc.blue = 0; xc.pixel = 0; XAllocColor( flx->display, fli_colormap( fl_vmode ), &xc ); - M_warn( "be_nice", "Get Black = %ld", xc.pixel ); + M_warn( __func__, "Get Black = %ld", xc.pixel ); if ( white == 1 ) { xc.pixel = white; xc.red = xc.green = xc.blue = 0xffff; XAllocColor( flx->display, fli_colormap( fl_vmode ), &xc ); - M_warn( "be_nice", "Get White = %ld", xc.pixel ); + M_warn( __func__, "Get White = %ld", xc.pixel ); } } else if ( white == 0 ) { xc.red = xc.green = xc.blue = 0xffff; XAllocColor( flx->display, fli_colormap( fl_vmode ), &xc ); - M_warn( "be_nice", "Get White = %ld", xc.pixel ); + M_warn( __func__, "Get White = %ld", xc.pixel ); if ( black == 1 ) { xc.red = xc.green = xc.blue = black; xc.pixel = 0; XAllocColor( flx->display, fli_colormap( fl_vmode ), &xc ); - M_warn( "be_nice", "Get Black = %ld", xc.pixel ); + M_warn( __func__, "Get Black = %ld", xc.pixel ); } } } - M_warn( "be_nice", "Total %d colors copied", save > 0 ? save : 2 ); + M_warn( __func__, "Total %d colors copied", save > 0 ? save : 2 ); } @@ -505,7 +505,7 @@ fill_map( void ) lut = fl_state[ fl_vmode ].lut; fli_dithered( fl_vmode ) = fli_depth( fl_vmode ) <= 2; - M_warn( "fill_map", "Trying to get %d colors", pred ); + M_warn( __func__, "Trying to get %d colors", pred ); xc.flags = DoRed | DoGreen | DoBlue; @@ -564,7 +564,7 @@ get_private_cmap( int vmode ) int ok, i; - M_warn( "get_private_cmap", "getting private colormap" ); + M_warn( __func__, "getting private colormap" ); /* Get a private colormap */ @@ -574,7 +574,7 @@ get_private_cmap( int vmode ) AllocNone : AllocAll ); if ( ! fli_map( vmode ) ) { - M_err( "get_private_cmap", "Can't create Colormap!" ); + M_err( __func__, "Can't create Colormap!" ); exit( 0 ); } @@ -594,7 +594,7 @@ get_private_cmap( int vmode ) for ( i = FL_BUILT_IN_COLS; i < FL_MAX_COLS; i++ ) lut[ i ] = i; - M_warn( "get_private_cmap", "%s %s succesful", + M_warn( __func__, "%s %s succesful", fli_vclass_name( vmode ), ok ? "" : "not" ); return ok; @@ -618,12 +618,12 @@ get_standard_cmap( int vmode ) XA_RGB_GRAY_MAP : XA_RGB_DEFAULT_MAP; #if FL_DEBUG >= ML_ERR - M_warn( "get_standard_cmap", "Getting standard colormap" ); + M_warn( __func__, "Getting standard colormap" ); #endif if ( ! XGetStandardColormap( flx->display, fl_root, &stdcmap, mapid ) ) { - M_err( "get_standard_cmap", "Can't get standard map" ); + M_err( __func__, "Can't get standard map" ); return 0; } @@ -662,7 +662,7 @@ get_shared_cmap( int vmode ) if ( fli_visual( vmode ) == DefaultVisual( flx->display, fl_screen ) ) { fli_map( vmode ) = DefaultColormap( flx->display, fl_screen ); - M_warn( "get_shared_cmap", "Using default map %ld for %s", + M_warn( __func__, "Using default map %ld for %s", fli_map( vmode ), fli_vclass_name( vmode ) ); } else @@ -671,14 +671,14 @@ get_shared_cmap( int vmode ) fli_visual( vmode ), vmode != FL_DirectColor ? AllocNone : AllocAll ); - M_warn( "get_shared_cmap", " NewMap %ld (0x%lx) for %s (ID = 0x%lx)", + M_warn( __func__, " NewMap %ld (0x%lx) for %s (ID = 0x%lx)", fli_map( vmode ), fli_map( vmode ), fli_vclass_name( vmode ), fli_visual( vmode )->visualid ); } if ( ! fli_map( vmode ) ) { - M_err( "get_shared_cmap", "Error getting colormaps" ); + M_err( __func__, "Error getting colormaps" ); exit( 1 ); } @@ -715,8 +715,7 @@ get_shared_cmap( int vmode ) if ( ! ok ) { - M_warn( "get_shared_cmap", "can't share for %s", - fli_vclass_name( vmode ) ); + M_warn( __func__, "can't share for %s", fli_vclass_name( vmode ) ); fli_map( vmode ) = XCopyColormapAndFree( flx->display, fli_map( vmode ) ); } @@ -755,11 +754,11 @@ fli_create_gc( Window win ) /* Need to create new GCs */ - M_warn( "fli_create_gc", "For %s", fli_vclass_name( fl_vmode ) ); + M_warn( __func__, "For %s", fli_vclass_name( fl_vmode ) ); if ( ! fli_gray_pattern[ 1 ] ) { - M_err( "fli_create_gc", "gray pattern not initialized" ); + M_err( __func__, "gray pattern not initialized" ); exit( 1 ); } @@ -838,7 +837,7 @@ fli_init_colormap( int vmode ) if ( fli_map( vmode ) ) { #if FL_DEBUG >= ML_DEBUG - M_info( "fli_init_colormap", "%s is ok", fli_vclass_name( vmode ) ); + M_info( __func__, "%s is ok", fli_vclass_name( vmode ) ); #endif return; } @@ -853,7 +852,7 @@ fli_init_colormap( int vmode ) max_server_cols = 1L << fli_depth( vmode ); predefined_cols = FL_min( FL_BUILT_IN_COLS, max_server_cols ); - M_info( "fli_init_colormap", "MaxColors = %d PredefCol = %d", + M_info( __func__, "MaxColors = %d PredefCol = %d", max_server_cols, predefined_cols ); fli_init_stipples( ); @@ -883,7 +882,7 @@ fli_init_colormap( int vmode ) if ( cols_in_default_visual <= 0 ) cols_in_default_visual = 80; - M_warn( "fli_init_colormap", "%ld (0x%lx)", defmap, defmap ); + M_warn( __func__, "%ld (0x%lx)", defmap, defmap ); XQueryColors( flx->display, defmap, defaultc, FL_min( cols_in_default_visual, DEFAULT_SAVE ) ); @@ -900,7 +899,7 @@ fli_init_colormap( int vmode ) /* If unable to share colormaps, we can either get a private colormap or force substitutions */ #if 1 - M_err( "fli_init_colormap", + M_err( __func__, "Failed to share colors. Using private colormap" ); ok = get_private_cmap( vmode ); #else @@ -912,12 +911,12 @@ fli_init_colormap( int vmode ) if ( ! ok ) { - M_err( "fli_init_colormap", + M_err( __func__, "I screwed up or you have a weird workstatation" ); exit( 1 ); } - M_warn( "fli_init_colormap", "%s Done", fli_vclass_name( vmode ) ); + M_warn( __func__, "%s Done", fli_vclass_name( vmode ) ); #if FL_DEBUG >= ML_WARN fli_dump_state_info( vmode, "fli_init_colormap" ); @@ -969,7 +968,7 @@ fl_get_pixel( FL_COLOR col ) if ( col >= FL_MAX_COLS ) { - M_err( "fl_get_pixel", "Bad request %lu", col ); + M_err( __func__, "Bad request %lu", col ); return 0; } @@ -1198,7 +1197,7 @@ fl_mapcolor( FL_COLOR col, /* If requested color is reserved, warn */ if ( col < FL_BUILT_IN_COLS ) - M_warn( "fl_mapcolor", "Changing reserved color" ); + M_warn( __func__, "Changing reserved color" ); /* Must invalidate color cache */ @@ -1209,8 +1208,7 @@ fl_mapcolor( FL_COLOR col, if ( col >= flmapsize ) { - M_err( "fl_mapcolor", - "Only %d indexed colors are supported", flmapsize ); + M_err( __func__, "Only %d indexed colors are supported", flmapsize ); return 0; } @@ -1245,7 +1243,7 @@ fl_mapcolor( FL_COLOR col, lastmapped = col; - M_warn( "fl_mapcolor", "mapping %ld (%d,%d,%d)", col, r, g, b ); + M_warn( __func__, "mapping %ld (%d,%d,%d)", col, r, g, b ); pixel = lut[ col ]; exact.red = ( r << 8 ) | 0xff; @@ -1276,7 +1274,7 @@ fl_mapcolor( FL_COLOR col, if ( ! cur_mapvals[ fl_vmode ] ) { - M_warn( "fl_mapcolor", "ColormapFull. Using substitutions" ); + M_warn( __func__, "ColormapFull. Using substitutions" ); totalcols = FL_min( FL_MAX_COLS, 1L << fli_depth( fl_vmode ) ); cur_map = fl_calloc( totalcols + 1, sizeof *cur_map ); @@ -1297,7 +1295,7 @@ fl_mapcolor( FL_COLOR col, if ( j < 0 ) { - M_err( "fl_mapcolor", "Something is very wrong" ); + M_err( __func__, "Something is very wrong" ); exit( 1 ); } @@ -1315,11 +1313,11 @@ fl_mapcolor( FL_COLOR col, exact.flags = DoRed | DoGreen | DoBlue; if ( ! XAllocColor( flx->display, fli_colormap( fl_vmode ), &exact ) ) - M_warn( "fl_mapcolor", "Something is wrong - will proceed" ); + M_warn( __func__, "Something is wrong - will proceed" ); #if FL_DEBUG >= ML_DEBUG - M_warn( "fl_mapcolor", "(%d %d %d)<->(%d %d %d)", + M_warn( __func__, "(%d %d %d)<->(%d %d %d)", r, g, b, cur_map[ j ].red, cur_map[ j ].green, cur_map[ j ].blue ); #endif @@ -1477,7 +1475,7 @@ fli_dump_state_info( int mode, if ( ! XMatchVisualInfo( flx->display, fl_screen, fli_depth( mode ), fli_class( mode ), &xvi ) ) { - M_err( "fli_dump_state_info", "Can't match listed visual" ); + M_err( __func__, "Can't match listed visual" ); exit( 1 ); } @@ -1485,13 +1483,13 @@ fli_dump_state_info( int mode, if ( fli_visual( mode )->visualid != xvi.visualid ) - M_warn( "fli_dump_state_info", "inconsistent visualID, probably OK" ); + M_warn( __func__, "inconsistent visualID, probably OK" ); /* State info consistency */ if ( fli_depth( mode ) != fs->xvinfo->depth ) { - M_err( "fli_dump_state_info", "Bad Depth" ); + M_err( __func__, "Bad Depth" ); exit( 1 ); } @@ -1515,14 +1513,14 @@ fl_mode_capable( int mode, if ( mode < 0 || mode > 5 ) { - M_err( "fl_mode_capable", "Bad mode = %d", mode ); + M_err( __func__, "Bad mode = %d", mode ); return 0; } cap = fli_depth( mode ) >= FL_MINDEPTH && fli_visual( mode ); if ( ! cap && warn ) - M_warn( "fl_mode_capable", "Not capable of %s at depth = %d", + M_warn( __func__, "Not capable of %s at depth = %d", fli_vclass_name( mode ), fli_depth( mode ) ); return cap; @@ -1655,7 +1653,7 @@ fl_create_colormap( XVisualInfo * xv, if ( k ) { - M_warn( "fl_create_colormap", "free %d\n", k ); + M_warn( __func__, "free %d\n", k ); XFreeColors( flx->display, cmap, pixels, k, 0 ); } } @@ -1685,7 +1683,7 @@ bad_color_handler( Display * d FL_UNUSED_ARG, XErrorEvent * xev ) { if ( xev->error_code == BadAccess ) - M_warn( "bad_color_handler", "bad pixel" ); + M_warn( __func__, "bad pixel" ); return 0; } @@ -1728,7 +1726,7 @@ fl_free_colors( FL_COLOR * c, /* If requested color is reserved, warn */ if ( *c < FL_FREE_COL1 ) - M_warn( "fl_free_colors", "Freeing reserved color" ); + M_warn( __func__, "Freeing reserved color" ); /* Must invalidate color cache */ diff --git a/lib/fldraw.c b/lib/fldraw.c index 612f528..cf1e4ca 100644 --- a/lib/fldraw.c +++ b/lib/fldraw.c @@ -543,7 +543,7 @@ fl_draw_box( int style, if ( style & FLI_BROKEN_BOX ) fl_foldertab_box( style, x, y, w, h, c, bw_in ); else - M_err( "fl_draw_box", "Unkonwn boxtype: %d", style ); + M_err( __func__, "Unkonwn boxtype: %d", style ); break; } } @@ -800,7 +800,7 @@ fli_add_vertex( FL_Coord x, { if ( npt >= MAX_BUF_POINT ) { - M_err( "fli_add_vertex", "Vertices Out of bounds" ); + M_err( __func__, "Vertices Out of bounds" ); return; } @@ -818,7 +818,7 @@ fli_add_float_vertex( float x, { if ( npt >= MAX_BUF_POINT ) { - M_err( "fli_add_float_vertex", "Vertices Out of bounds" ); + M_err( __func__, "Vertices Out of bounds" ); return; } @@ -846,7 +846,7 @@ fli_endline( void ) { if ( npt >= MAX_BUF_POINT ) { - M_err( "fli_endline", "Vertices Out of bounds" ); + M_err( __func__, "Vertices Out of bounds" ); return; } @@ -862,7 +862,7 @@ fli_endclosedline( void ) { if ( npt + 1 >= MAX_BUF_POINT ) { - M_err( "fli_endclosedline", "Vertices Out of bounds" ); + M_err( __func__, "Vertices Out of bounds" ); return; } @@ -878,7 +878,7 @@ fli_endpolygon( void ) { if ( npt + 1 >= MAX_BUF_POINT ) { - M_err( "fli_endpolygon", "Vertices Out of bounds" ); + M_err( __func__, "Vertices Out of bounds" ); return; } diff --git a/lib/flresource.c b/lib/flresource.c index 666acd0..ffb7ba9 100644 --- a/lib/flresource.c +++ b/lib/flresource.c @@ -422,11 +422,11 @@ handle_applresdir( const char * rstr, for ( tok = strtok( rbuf, ":" ); tok; tok = strtok( 0, ":" ) ) { fli_snprintf( buf, sizeof buf,"%s/%s", tok,appclass ); - M_info( "handle_applresdir", "Trying XAPPLRESDIR: %s", buf ); + M_info( __func__, "Trying XAPPLRESDIR: %s", buf ); if ( ( fdb = XrmGetFileDatabase( buf ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "handle_applresdir", "XAPPLRESDIR %s loaded", buf ); + M_warn( __func__, "XAPPLRESDIR %s loaded", buf ); } } } @@ -446,7 +446,7 @@ init_resource_database( const char *appclass ) if ( ! fl_display ) { - M_err( "init_resource_database", "fl_initialize is not called" ); + M_err( __func__, "fl_initialize is not called" ); return; } @@ -465,63 +465,63 @@ init_resource_database( const char *appclass ) */ fli_snprintf( buf, sizeof buf, "DECW$SYSTEM_DEFAULTS:%s.DAT", appclass ); - M_info( "init_resource_database", "Trying Sys_default: %s", buf ); + M_info( __func__, "Trying Sys_default: %s", buf ); if ( ( fdb = XrmGetFileDatabase( buf ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "System default %s loaded", buf ); + M_warn( __func__, "System default %s loaded", buf ); } fli_snprintf( buf, sizeof buf, "DECW$USER_DEFAULTS:%s.DAT", appclass ); - M_info( "init_resource_database", "Trying User_default: %s", buf ); + M_info( __func__, "Trying User_default: %s", buf ); if ( ( fdb = XrmGetFileDatabase( buf ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "System default %s loaded", buf ); + M_warn( __func__, "System default %s loaded", buf ); } fli_snprintf( buf, sizeof buf, "DECW$USER_DEFAULTS:DECW$XDEFAULTS.DAT" ); - M_info( "init_resource_database", "Trying Sys_default: %s", buf ); + M_info( __func__, "Trying Sys_default: %s", buf ); if ( ( fdb = XrmGetFileDatabase( buf ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "System default %s loaded", buf ); + M_warn( __func__, "System default %s loaded", buf ); } - M_info( "init_resource_database", "Trying RESOURCE_MANAGER" ); + M_info( __func__, "Trying RESOURCE_MANAGER" ); if ( ( rstr = XResourceManagerString( fl_display ) ) ) { if ( ( fdb = XrmGetStringDatabase( rstr ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "RESOURCE_MANAGER loaded" ); + M_warn( __func__, "RESOURCE_MANAGER loaded" ); } } #else /* !VMS */ fli_snprintf( buf, sizeof buf, "/usr/lib/X11/app-defaults/%s", appclass ); - M_info( "init_resource_database", "Trying Sys_default: %s", buf ); + M_info( __func__, "Trying Sys_default: %s", buf ); if ( ( fdb = XrmGetFileDatabase( buf ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "System default %s loaded", buf ); + M_warn( __func__, "System default %s loaded", buf ); } /* try XAPPLRESDIR */ - M_info( "init_resource_database", "Trying XAPPLRESDIR" ); + M_info( __func__, "Trying XAPPLRESDIR" ); if ( ( rstr = getenv( "XAPPLRESDIR" ) ) ) handle_applresdir( rstr, appclass ); /* try server defined resources */ - M_info( "init_resource_database", "Trying RESOURCE_MANAGER" ); + M_info( __func__, "Trying RESOURCE_MANAGER" ); if ( ( rstr = XResourceManagerString( fl_display ) ) ) { if ( ( fdb = XrmGetStringDatabase( rstr ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "RESOURCE_MANAGER loaded" ); + M_warn( __func__, "RESOURCE_MANAGER loaded" ); } } else @@ -531,32 +531,31 @@ init_resource_database( const char *appclass ) if ( ( rstr = getenv( "HOME" ) ) ) { fli_snprintf( buf, sizeof buf,"%s/.Xdefaults", rstr ); - M_info( "init_resource_database", "Trying %s", buf ); + M_info( __func__, "Trying %s", buf ); if ( ( fdb = XrmGetFileDatabase( buf ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "%s loaded", buf ); + M_warn( __func__, "%s loaded", buf ); } } } /* Load file XENVIRONMENT */ - M_info( "init_resource_database", - "Trying environment variable XEVIRONMENT" ); + M_info( __func__, "Trying environment variable XEVIRONMENT" ); if ( ( rstr = getenv( "XENVIRONMENT" ) ) ) { if ( ( fdb = XrmGetFileDatabase( rstr ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "%s loaded", rstr ); + M_warn( __func__, "%s loaded", rstr ); } } else { /* ~/.Xdefaults-<hostname> */ - M_info( "init_resource_database", "Trying ~/.Xdefaults-<hostname>" ); + M_info( __func__, "Trying ~/.Xdefaults-<hostname>" ); if ( ( rstr = getenv( "HOME" ) ) ) { int l; @@ -564,11 +563,11 @@ init_resource_database( const char *appclass ) fli_snprintf( buf, sizeof buf,"%s/.Xdefaults", rstr ); l = strlen( strcat( buf, "-" ) ); gethostname( buf + l, sizeof buf - l ); - M_info( "init_resource_database", "Trying %s", buf ); + M_info( __func__, "Trying %s", buf ); if ( ( fdb = XrmGetFileDatabase( buf ) ) ) { XrmMergeDatabases( fdb, &fldatabase ); - M_warn( "init_resource_database", "%s loaded", buf ); + M_warn( __func__, "%s loaded", buf ); } } } @@ -578,8 +577,7 @@ init_resource_database( const char *appclass ) if ( ! fldatabase ) { - M_warn( "init_resource_database", - "Can't find any resource databases!" ); + M_warn( __func__, "Can't find any resource databases!" ); return; } } @@ -643,12 +641,11 @@ fl_get_resource( const char * rname, /* resource name */ || strcmp( type, "String" ) || ! entry.addr ) { - M_warn( "fl_get_resource", "%s (%s): not found", res_name, res_class ); + M_warn( __func__, "%s (%s): not found", res_name, res_class ); entry.addr = ( XPointer ) defval; } else - M_info( "fl_get_resource", "%s (%s): %s", res_name, res_class, - entry.addr ); + M_info( __func__, "%s (%s): %s", res_name, res_class, entry.addr ); if ( dtype == FL_NONE || ! entry.addr ) return entry.addr; @@ -684,7 +681,7 @@ fl_get_resource( const char * rname, /* resource name */ break; default: - M_err( "fl_get_resource", "Unknown type %d", dtype ); + M_err( __func__, "Unknown type %d", dtype ); return NULL; } @@ -738,7 +735,7 @@ fli_init_resources( void ) if ( fli_cntl.sync ) { XSynchronize( fl_display, 1 ); - M_err( "fli_init_resources", "**** Synchronous Mode ********" ); + M_err( __func__, "**** Synchronous Mode ********" ); fli_set_debug_level( 4 ); } } @@ -866,7 +863,7 @@ fli_init_context( void ) if ( ! ( fli_context = fl_calloc( 1, sizeof *fli_context ) ) ) { - M_err( "fli_init_context", "Running out of memory" ); + M_err( __func__, "Running out of memory" ); exit( 1 ); } @@ -916,7 +913,7 @@ fl_initialize( int * na, if ( fl_display ) { - M_warn( "fl_initialize", "XForms: already initialized" ); + M_warn( __func__, "XForms: already initialized" ); return fl_display; } @@ -924,8 +921,7 @@ fl_initialize( int * na, if ( ! na || ! *na ) { - M_err( "fl_initialize", - "XForms: argc == 0 or argv == NULL detected\n" ); + M_err( __func__, "XForms: argc == 0 or argv == NULL detected\n" ); exit( 1 ); } @@ -991,7 +987,7 @@ fl_initialize( int * na, /* if no display is set, there is no guarantee that buf is long enough to contain the DISPLAY setting */ - M_err( "fl_initialize", "%s: Can't open display %s", fli_argv[ 0 ], + M_err( __func__, "%s: Can't open display %s", fli_argv[ 0 ], XDisplayName( buf[ 0 ] ? buf : 0 ) ); return 0; } @@ -1040,12 +1036,12 @@ fl_initialize( int * na, fli_snprintf( disp_name, sizeof disp_name, "%s.name", fl_app_name ); fli_snprintf( disp_cls, sizeof disp_cls , "%s.Name", fl_app_class ); - M_warn( "fl_initialize", "Trying display %s", disp_name ); + M_warn( __func__, "Trying display %s", disp_name ); if ( XrmGetResource( cmddb, disp_name, disp_cls, &type, &xval ) ) { fl_app_name = fl_strdup( xval.addr ); - M_warn( "fl_initialize", "Changed AppName from %s to %s", + M_warn( __func__, "Changed AppName from %s to %s", fl_ori_app_name, fl_app_name ); } @@ -1123,7 +1119,7 @@ fl_initialize( int * na, if ( fl_root != fl_vroot ) { - M_warn( "fl_initialize", "fl_root = %lu fl_vroot = %lu", + M_warn( __func__, "fl_root = %lu fl_vroot = %lu", fl_root, fl_vroot ); /* tvtwm requires this to position a window relative to the current @@ -1139,7 +1135,7 @@ fl_initialize( int * na, ydpi = fl_scrh * 25.4 / DisplayHeightMM( fl_display, fl_screen ); if ( xdpi / ydpi > 1.05 || ydpi / xdpi < 0.95 ) - M_warn( "fl_initialize", "NonSquarePixel %.1f %.1f", xdpi, ydpi ); + M_warn( __func__, "NonSquarePixel %.1f %.1f", xdpi, ydpi ); fl_dpi = FL_nint( FL_nint( 10 * ( xdpi + ydpi ) / 2 ) / 10.0 ); @@ -1149,7 +1145,7 @@ fl_initialize( int * na, // // printf( "screen DPI = %f", fl_dpi ); - M_info( "fl_initialize", "screen DPI = %f", fl_dpi ); + M_info( __func__, "screen DPI = %f", fl_dpi ); fl_vmode = fli_initialize_program_visual( ); fli_init_colormap( fl_vmode ); @@ -1179,12 +1175,12 @@ fl_initialize( int * na, if ( ! fli_context->xic ) { - M_err( "fl_initialize", "Could not create an input context" ); + M_err( __func__, "Could not create an input context" ); XCloseIM( fli_context->xim ); } } else - M_err( "fl_initialize", "Could not create an input method" ); + M_err( __func__, "Could not create an input method" ); } #endif @@ -1229,7 +1225,7 @@ fl_initialize( int * na, if ( fli_context->max_request_size < 4096 ) { - M_err( "fl_initialize", "Something is wrong with max_request_size: %ld", + M_err( __func__, "Something is wrong with max_request_size: %ld", fli_context->max_request_size ); fli_context->max_request_size = 4096; } @@ -1451,7 +1447,7 @@ fli_get_app_resource( FL_resource * appresource, for ( ; flr < flrs; flr++ ) if ( flr->type == FL_STRING && flr->nbytes == 0 ) - M_err( "fl_get_app_resources", "%s: buflen == 0", flr->res_name ); + M_err( __func__, "%s: buflen == 0", flr->res_name ); else fl_get_resource( flr->res_name, flr->res_class, flr->type, flr->defval, flr->var, flr->nbytes ); @@ -1487,7 +1483,7 @@ fl_flip_yorigin( void ) if ( ! fl_display ) fli_inverted_y = 1; else - M_err( "fl_flip_yorigin", "Only supported before fl_initialize" ); + M_err( __func__, "Only supported before fl_initialize" ); } diff --git a/lib/flvisual.c b/lib/flvisual.c index cf8f0cc..c4e3cba 100644 --- a/lib/flvisual.c +++ b/lib/flvisual.c @@ -64,11 +64,11 @@ RGBmode_init( int v ) fli_xvisual2flstate( s, s->xvinfo ); #if FL_DEBUG >= ML_WARN - M_info( "RGBmode_init", "%s: bits_per_rgb = %d", + M_info( __func__, "%s: bits_per_rgb = %d", fli_vclass_name( v ), s->rgb_bits ); - M_info( "RGBmode_init", "RS = %d GS = %d BS = %d", + M_info( __func__, "RS = %d GS = %d BS = %d", s->rshift, s->gshift, s->bshift ); - M_info( "RGBmode_init", "RB = %d GB = %d BB = %d", + M_info( __func__, "RB = %d GB = %d BB = %d", s->rbits, s->gbits, s->bbits ); #endif } @@ -94,8 +94,7 @@ check_user_preference( int * vmode, reqd = fli_cntl.depth; #if FL_DEBUG >= ML_WARN - M_warn( "check_user_preference", "UserRequest: %s %d", - reqv >= 0 ? + M_warn( __func__, "UserRequest: %s %d", reqv >= 0 ? fli_vclass_name( reqv ) : "None", reqd > 0 ? reqd : 0 ); #endif @@ -156,7 +155,7 @@ select_best_visual( void ) if ( ! ( xv = XGetVisualInfo( fl_display, VisualScreenMask, &xvt, &xvn ) ) ) { - M_err( "select_best_visual", " Can't get VisualInfo!" ); + M_err( __func__, " Can't get VisualInfo!" ); exit( 1 ); } @@ -187,9 +186,9 @@ select_best_visual( void ) #if FL_DEBUG >= ML_DEBUG if ( fli_cntl.debug ) { - M_warn( "select_best_visual", "XlibVersion: %s", XlibVersion ); - M_info( "select_best_visual", "DPI = %d", fl_dpi ); - M_warn( "select_best_visual", "No. of Visuals: %d", xvn ); + M_warn( __func__, "XlibVersion: %s", XlibVersion ); + M_info( __func__, "DPI = %d", fl_dpi ); + M_warn( __func__, "No. of Visuals: %d", xvn ); for ( j = 0; j < 6; j++ ) if ( bestv[ j ] ) fprintf( stderr, @@ -205,8 +204,7 @@ select_best_visual( void ) if ( max_server_depth < FL_MINDEPTH ) { - M_err( "select_best_visual", - "MaxServerDepth = %d. XForms requires at least %d. Sorry", + M_err( __func__, "MaxServerDepth = %d. XForms requires at least %d", max_server_depth, FL_MINDEPTH ); exit( 1 ); } @@ -230,7 +228,7 @@ select_best_visual( void ) bvmode = xv[ 0 ].class; else { - M_err( "select_best_visual", "Can't find an appropriate visual" ); + M_err( __func__, "Can't find an appropriate visual" ); exit( 1 ); } @@ -258,8 +256,7 @@ fli_initialize_program_visual( void ) vmode = select_best_visual( ); #if FL_DEBUG >= ML_WARN - M_warn( "fli_initialize_program_visual", - "Initial visual: %s (ID = 0x%lx) depth = %d", + M_warn( __func__, "Initial visual: %s (ID = 0x%lx) depth = %d", fli_vclass_name( vmode ), fli_visual( vmode )->visualid, fli_depth( vmode ) ); #endif @@ -271,14 +268,13 @@ fli_initialize_program_visual( void ) depth = fli_depth( vmode ); - M_warn( "fli_initialize_program_visual", "ProgramDefault: %s %d", - fli_vclass_name( vmode ), depth); + M_warn( __func__, "ProgramDefault: %s %d", fli_vclass_name( vmode ), depth); /* Give user a chance to select a visual */ check_user_preference( &vmode, &depth ); - M_warn( "fli_initialize_program_visual", "UserPreference: %s %d", + M_warn( __func__, "UserPreference: %s %d", fli_vclass_name( vmode ), depth ); /* If requested a visualID directly, honor it here */ @@ -289,8 +285,7 @@ fli_initialize_program_visual( void ) *retxv; int nv; - M_warn( "fli_initialize_program_visual", "UserRequestedVID: 0x%lx", - fli_requested_vid ); + M_warn( __func__, "UserRequestedVID: 0x%lx", fli_requested_vid ); xv.visualid = fli_requested_vid; @@ -306,8 +301,7 @@ fli_initialize_program_visual( void ) } else { - M_err( "fli_initialize_program_visual", "Can't find visualID 0x%lx", - fli_requested_vid ); + M_err( __func__, "Can't find visualID 0x%lx", fli_requested_vid ); fli_requested_vid = 0; } } @@ -330,8 +324,7 @@ fli_initialize_program_visual( void ) { /* Bogus request. Revert to the best visual we have found */ - M_err( "fli_initialize_program_visual", - "Bogus request: %s with depth = %d", + M_err( __func__, "Bogus request: %s with depth = %d", fli_vclass_name( vmode ), depth ); vmode = select_best_visual( ); @@ -341,8 +334,7 @@ fli_initialize_program_visual( void ) program_vclass = vmode; #if FL_DEBUG >= ML_WARN - M_warn( "fli_initialize_program_visual", - "SelectedVisual: %s (ID = 0x%lx) depth = %d", + M_warn( __func__, "SelectedVisual: %s (ID = 0x%lx) depth = %d", fli_vclass_name( vmode ), fli_visual( vmode )->visualid, fli_depth( vmode ) ); #endif diff --git a/lib/formbrowser.c b/lib/formbrowser.c index 19b09d7..8b6b759 100644 --- a/lib/formbrowser.c +++ b/lib/formbrowser.c @@ -183,8 +183,7 @@ fl_get_formbrowser_topform( FL_OBJECT * ob ) if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_get_formbrowser_topform", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return NULL; } @@ -253,20 +252,19 @@ fl_addto_formbrowser( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_addto_formbrowser", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return 0; } if ( ! form ) { - M_err( "fl_addto_formbrowser", "Invalid argument" ); + M_err( __func__, "Invalid argument" ); return 0; } if ( form->attached ) { - M_err( "fl_addto_formbrowser", "Already attached ?" ); + M_err( __func__, "Already attached ?" ); return 0; } @@ -308,14 +306,13 @@ fl_find_formbrowser_form_number( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_find_formbrowser_form_number", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return 0; } if ( ! form ) { - M_err( "fl_find_formbrowser_form_number", "Invalid argument" ); + M_err( __func__, "Invalid argument" ); return 0; } @@ -341,14 +338,13 @@ fl_delete_formbrowser( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_delete_formbrowser", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return -1; } if ( ! form ) { - M_err( "fl_delete_formbrowser", "Invalid argument" ); + M_err( __func__, "Invalid argument" ); return -1; } @@ -388,8 +384,7 @@ fl_delete_formbrowser_bynumber( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_delete_formbrowser_bynumber", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return NULL; } @@ -397,8 +392,7 @@ fl_delete_formbrowser_bynumber( FL_OBJECT * ob, if ( num <= 0 || num > sp->nforms ) { - M_err( "fl_delete_formbrowser_bynumber", - "Invalid argument -- %d not between 1 and %d", + M_err( __func__, "Invalid argument -- %d not between 1 and %d", num, sp->nforms ); return NULL; } @@ -423,8 +417,7 @@ fl_replace_formbrowser( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_replace_formbrowser", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "objecy %s not a formbrowser", ob ? ob->label : "" ); return NULL; } @@ -432,8 +425,7 @@ fl_replace_formbrowser( FL_OBJECT * ob, if ( num <= 0 || num > sp->nforms ) { - M_err( "fl_replace_formbrowser", - "Invalid argument -- %d not between 1 and %d", + M_err( __func__, "Invalid argument -- %d not between 1 and %d", num, sp->nforms ); return NULL; } @@ -462,8 +454,7 @@ fl_get_formbrowser_area( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_get_formbrowser_area", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return 0; } @@ -493,8 +484,7 @@ fl_insert_formbrowser( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_insert_formbrowser", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "objecy %s not a formbrowser", ob ? ob->label : "" ); return -1; } @@ -503,7 +493,7 @@ fl_insert_formbrowser( FL_OBJECT * ob, if ( line <= 0 || line > nforms ) { - M_err( "fl_insert_formbrowser", "Invalid argument" ); + M_err( __func__, "Invalid argument" ); return -1; } @@ -511,7 +501,7 @@ fl_insert_formbrowser( FL_OBJECT * ob, if ( ! form ) { - M_err( "fl_insert_formbrowser", "Running out of memory" ); + M_err( __func__, "Running out of memory" ); return -1; } @@ -592,8 +582,7 @@ fl_set_formbrowser_xoffset( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_set_formbrowser_xoffset", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return 0; } @@ -623,8 +612,7 @@ fl_get_formbrowser_xoffset( FL_OBJECT * ob ) { if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_get_formbrowser_xoffset", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return 0; } @@ -646,8 +634,7 @@ fl_set_formbrowser_yoffset( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_set_formbrowser_yoffset", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return 0; } @@ -687,8 +674,7 @@ fl_get_formbrowser_yoffset( FL_OBJECT * ob ) if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_get_formbrowser_yoffset", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return 0; } @@ -708,8 +694,7 @@ fl_get_formbrowser_numforms( FL_OBJECT * ob ) { if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_get_formbrowser_numforms", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return -1; } @@ -729,8 +714,7 @@ fl_get_formbrowser_form( FL_OBJECT * ob, if ( ! IsFormBrowserClass( ob ) ) { - M_err( "fl_get_formbrowser_form", "%s not a formbrowser", - ob ? ob->label : "null" ); + M_err( __func__, "object %s not a formbrowser", ob ? ob->label : "" ); return NULL; } @@ -739,8 +723,7 @@ fl_get_formbrowser_form( FL_OBJECT * ob, if ( n >= 1 && n <= sp->nforms ) form = sp->form[ n - 1 ]; else - M_err( "fl_get_formbrowser_form", - "%d is not an allowable form number", n ); + M_err( __func__, "%d is not an allowable form number", n ); return form; } diff --git a/lib/fselect.c b/lib/fselect.c index 76c99a1..96fb2ae 100644 --- a/lib/fselect.c +++ b/lib/fselect.c @@ -186,8 +186,7 @@ fl_add_fselector_appbutton( const char * label, } if ( ! ok ) - M_err( "fl_add_fselector_appbutton", "Only %d allowd. %s ignored", - MAX_APPBUTT, label ); + M_err( __func__, "Only %d allowd. %s ignored", MAX_APPBUTT, label ); } @@ -383,7 +382,7 @@ fl_set_directory( const char * p ) if ( p == NULL ) { - M_err( "fl_set_directory", "invalid NULL argument" ); + M_err( __func__, "invalid NULL argument" ); return 1; } @@ -395,7 +394,7 @@ fl_set_directory( const char * p ) fli_fix_dirname( tmpdir ); if ( ! fli_is_valid_dir( tmpdir ) ) { - M_err( "fl_set_directory", "invalid directory: %s", tmpdir ); + M_err( __func__, "invalid directory: %s", tmpdir ); return 1; } @@ -498,7 +497,7 @@ fill_entries( FL_OBJECT * br, fl_show_alert( "ReadDir", tmpbuf, fli_get_syserror_msg( ), 0 ); fl_free( tmpbuf ); } - M_err( "fill_entries", "Can't read %s", lfs->dname ); + M_err( __func__, "Can't read %s", lfs->dname ); /* Backup */ diff --git a/lib/goodie_alert.c b/lib/goodie_alert.c index f10e269..928e956 100644 --- a/lib/goodie_alert.c +++ b/lib/goodie_alert.c @@ -225,7 +225,7 @@ fl_hide_alert( void ) if ( fd_alert && fd_alert->form->visible ) fl_trigger_object( fd_alert->but ); else - M_warn( "fl_hide_alert", "No alert box is shown" ); + M_warn( __func__, "No alert box is shown" ); } diff --git a/lib/goodie_choice.c b/lib/goodie_choice.c index 53f5fe6..a6b03f4 100644 --- a/lib/goodie_choice.c +++ b/lib/goodie_choice.c @@ -199,7 +199,7 @@ fl_show_choice( const char * m1, if ( len == 3 ) { - M_warn( "fl_show_choice", "Only NULL or empty strings" ); + M_warn( __func__, "Only NULL or empty strings" ); return 0; } diff --git a/lib/goodie_colchooser.c b/lib/goodie_colchooser.c index 5ec17db..1b628ee 100644 --- a/lib/goodie_colchooser.c +++ b/lib/goodie_colchooser.c @@ -538,7 +538,7 @@ fl_show_color_chooser( const int * rgb_in, if ( rgb_out == NULL ) { - M_err( "fl_show_color_chooser", + M_err( __func__, "Argument for returning selected color is a NULL pointer" ); return 0; } diff --git a/lib/goodie_input.c b/lib/goodie_input.c index 20f4d36..8adae4e 100644 --- a/lib/goodie_input.c +++ b/lib/goodie_input.c @@ -178,7 +178,7 @@ fl_hide_input( void ) if ( fd_input ) fl_trigger_object( fd_input->cancel ); else - M_warn( "fl_hide_input", "No input box is shown" ); + M_warn( __func__, "No input box is shown" ); } diff --git a/lib/goodie_msg.c b/lib/goodie_msg.c index 5692ca7..ef246a5 100644 --- a/lib/goodie_msg.c +++ b/lib/goodie_msg.c @@ -130,7 +130,7 @@ fl_show_messages( const char *str ) { if ( ! str || ! * str ) { - M_warn( "fl_show_messages", "NULL or empty string" ); + M_warn( __func__, "NULL or empty string" ); return; } @@ -191,7 +191,7 @@ fl_show_message( const char * s1, if ( len == 3 ) { - M_warn( "fl_show_message", "Only NULL or empty strings" ); + M_warn( __func__, "Only NULL or empty strings" ); return; } @@ -215,7 +215,7 @@ fl_hide_message( void ) if ( fd_msg ) fl_trigger_object( fd_msg->but ); else - M_warn( "fl_hide_message", "No message box is shown" ); + M_warn( __func__, "No message box is shown" ); } diff --git a/lib/goodie_yesno.c b/lib/goodie_yesno.c index 0175dcf..59bb8c5 100644 --- a/lib/goodie_yesno.c +++ b/lib/goodie_yesno.c @@ -183,7 +183,7 @@ fl_hide_question( void ) if ( fd_yesno ) fl_trigger_object( default_ans == 1 ? fd_yesno->yes : fd_yesno->no ); else - M_warn( "fl_hide_question", "No question box is shown" ); + M_warn( __func__, "No question box is shown" ); } diff --git a/lib/handling.c b/lib/handling.c index 6c255cd..cfe5e3c 100644 --- a/lib/handling.c +++ b/lib/handling.c @@ -218,7 +218,7 @@ do_shortcut( FL_FORM * form, key1 = key2 = FL_ALT_MASK + key; } - M_info( "do_shortcut", "win = %ld key = %d %d %d", + M_info( __func__, "win = %ld key = %d %d %d", form->window, key, key1, key2 ); /* Check if an object has this as a shortcut */ @@ -969,7 +969,7 @@ handle_keyboard_event( XEvent * xev, if ( fli_int.keyform && fli_int.keyform->window != win ) { - M_warn( "handle_keyboard_event", "pointer/keybd focus differ" ); + M_warn( __func__, "pointer/keybd focus differ" ); if ( fli_int.keyform->child && fli_int.keyform->child->window != win @@ -987,9 +987,9 @@ handle_keyboard_event( XEvent * xev, if ( kbuflen < 0 ) { if ( kbuflen != INT_MIN ) - M_err( "handle_keyboard_event", "keyboad buffer overflow?" ); + M_err( __func__, "keyboad buffer overflow?" ); else - M_err( "handle_keyboard_event", "fli_XLookupString failed?" ); + M_err( __func__, "fli_XLookupString failed?" ); return; } @@ -1061,7 +1061,7 @@ handle_EnterNotify_event( FL_FORM * evform ) } #if FL_DEBUG >= ML_DEBUG else - M_err( "handle_EnterNotify_event", "Null form" ); + M_err( __func__, "Null form" ); #endif } @@ -1114,7 +1114,7 @@ handle_MotionNotify_event( FL_FORM * evform ) if ( ! fli_int.mouseform ) { - M_warn( "handle_MotionNotify_event", "event win = %ld", win ); + M_warn( __func__, "event win = %ld", win ); return; } @@ -1242,7 +1242,7 @@ handle_Expose_event( FL_FORM * evform, FL_Coord neww, newh; - M_warn( "handle_Expose_event", "Run into trouble - correcting it" ); + M_warn( __func__, "Run into trouble - correcting it" ); fl_get_winsize( evform->window, &neww, &newh ); fli_scale_form( evform, ( double ) neww / evform->w, ( double ) newh / evform->h ); @@ -1276,8 +1276,8 @@ handle_ConfigureNotify_event( FL_FORM * evform, { evform->x = st_xev.xconfigure.x; evform->y = st_xev.xconfigure.y; - M_warn( "handle_ConfigureNotify_event", "WMConfigure:x = %d y = %d" - "w = %d h = %d", evform->x, evform->y, st_xev.xconfigure.width, + M_warn( __func__, "WMConfigure:x = %d y = %d w = %d h = %d", + evform->x, evform->y, st_xev.xconfigure.width, st_xev.xconfigure.height ); } @@ -1452,7 +1452,7 @@ fl_do_only_forms( void ) } if ( obj == FL_EVENT ) - M_warn( "fl_do_only_forms", "Shouldn't happen" ); + M_warn( __func__, "Shouldn't happen" ); return obj; } diff --git a/lib/include/Basic.h b/lib/include/Basic.h index 544396b..34d29d2 100644 --- a/lib/include/Basic.h +++ b/lib/include/Basic.h @@ -1635,7 +1635,7 @@ FL_EXPORT int fl_is_same_object( FL_OBJECT * obj1, FL_EXPORT FL_COORD fl_adapt_to_dpi( FL_COORD size ); -FL_EXPORT FL_COORD fal_adapt_to_unit( FL_COORD size ); +FL_EXPORT FL_COORD fl_adapt_to_unit( FL_COORD size ); #endif /* ! defined FL_BASIC_H */ diff --git a/lib/input.c b/lib/input.c index 15c4601..257b2ac 100644 --- a/lib/input.c +++ b/lib/input.c @@ -2039,7 +2039,7 @@ fl_set_input_fieldchar( FL_OBJECT * obj, if ( obj->objclass != FL_INPUT ) { - M_err( "fl_set_input_fieldchar", "%s isn't an input object", + M_err( __func__, "object %s isn't an input object", obj ? obj->label : "null" ); return 0; } diff --git a/lib/interpol.c b/lib/interpol.c index 08bf1b3..381ecd6 100644 --- a/lib/interpol.c +++ b/lib/interpol.c @@ -55,7 +55,7 @@ fl_interpolate( const float * wx, if ( nin <= ndeg ) { - M_warn( "fl_interpolate", "too few points in interpol\n" ); + M_warn( __func__, "too few points in interpol\n" ); return -1; } diff --git a/lib/listdir.c b/lib/listdir.c index d2c2e65..6c05a77 100644 --- a/lib/listdir.c +++ b/lib/listdir.c @@ -543,7 +543,7 @@ fl_free_dirlist( const FL_Dirlist * dl ) if ( i == cache_size ) { - M_err( "fl_free_dirlist", "Bad list" ); + M_err( __func__, "Bad list" ); return; } @@ -953,7 +953,7 @@ tc_scandir( const char * dirname, if ( sizeof( struct DIRENT ) < 100 && ! dname_is_1 ) { - M_warn("tc_scandir", "Bad dirent -- will fix it on the fly" ); + M_warn( __func__, "Bad dirent -- will fix it on the fly" ); dname_is_1 = 1; } @@ -241,7 +241,7 @@ handle_menu( FL_OBJECT * ob, int ret = FL_RETURN_NONE; #if FL_DEBUG >= ML_DEBUG - M_info2( "handle_menu", fli_event_name( event ) ); + M_info2( __func__, fli_event_name( event ) ); #endif switch ( event ) @@ -478,7 +478,7 @@ addto_menu( FL_OBJECT * ob, { if ( ! isdigit( ( unsigned char ) p[ 2 ] ) ) { - M_err( "addto_menu", "Missing number after %%x" ); + M_err( __func__, "Missing number after %%x" ); sp->mval[ n ] = ++sp->cur_val; } else @@ -514,7 +514,7 @@ fl_set_menu( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_set_menu", "%s is not Menu class", ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return; } #endif @@ -566,7 +566,7 @@ fl_addto_menu( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_addto_menu", "%s is not Menu class", ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return 0; } #endif @@ -655,7 +655,7 @@ fl_replace_menu_item( FL_OBJECT * ob, } else { - M_err( "fl_replace_menu_item", "Missing number after %%x" ); + M_err( __func__, "Missing number after %%x" ); memmove( p, p + 2, strlen( p ) - 1 ); } } @@ -823,7 +823,7 @@ fl_get_menu( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_get_menu", "%s is not Menu class", ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return 0; } #endif @@ -847,8 +847,7 @@ fl_get_menu_maxitems( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_get_menu_maxitems", "%s is not Menu class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return 0; } #endif @@ -869,8 +868,7 @@ fl_get_menu_text( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_get_menu_text", "%s is not Menu class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return NULL; } #endif @@ -896,8 +894,7 @@ fl_get_menu_item_text( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_get_menu_item_text", "%s is not Menu class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return NULL; } #endif @@ -924,8 +921,7 @@ fl_get_menu_item_mode( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_get_menu_item_mode", "%s is not Menu class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return 0; } #endif @@ -950,8 +946,7 @@ fl_set_menu_popup( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_MENU ) ) { - M_err( "fl_set_menu_popup", "%s is not Menu class", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not Menu class", ob ? ob->label : "" ); return; } #endif diff --git a/lib/nmenu.c b/lib/nmenu.c index 3f53469..04d4659 100644 --- a/lib/nmenu.c +++ b/lib/nmenu.c @@ -112,7 +112,7 @@ fl_clear_nmenu( FL_OBJECT * obj ) if ( obj == NULL ) { - M_err( "fl_clear_nmenu_popup", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -153,7 +153,7 @@ fl_add_nmenu_items( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_add_nmenu_items", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -190,7 +190,7 @@ fl_insert_nmenu_items( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_add_nmenu_items", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -202,7 +202,7 @@ fl_insert_nmenu_items( FL_OBJECT * obj, if ( after != NULL && fli_check_popup_entry_exists( after ) != 0 ) { - M_err( "fl_add_nmenu_items", "Item to insert after doesn't exist" ); + M_err( __func__, "Item to insert after doesn't exist" ); return NULL; } @@ -231,13 +231,13 @@ fl_replace_nmenu_item( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_replace_nmenu_items", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } if ( ! items || ! *items ) { - M_err( "fl_replace_nmenu_item", "Items string NULL or empty" ); + M_err( __func__, "Items string NULL or empty" ); return NULL; } @@ -251,7 +251,7 @@ fl_replace_nmenu_item( FL_OBJECT * obj, if ( fli_check_popup_entry_exists( old_item ) ) { - M_err( "fl_replace_nmenu_item", "Item to replace doesn't exist" ); + M_err( __func__, "Item to replace doesn't exist" ); return NULL; } @@ -289,7 +289,7 @@ fl_delete_nmenu_item( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_delete_nmenu_item", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -301,7 +301,7 @@ fl_delete_nmenu_item( FL_OBJECT * obj, if ( fli_check_popup_entry_exists( item ) != 0 ) { - M_err( "fl_delete_nmenu_item", "Item doesnt exist" ); + M_err( __func__, "Item doesnt exist" ); return -1; } @@ -328,7 +328,7 @@ fl_set_nmenu_items( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_nmenu_items", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -369,13 +369,13 @@ fl_add_nmenu_items2( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_add_nmenu_items2", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } if ( ! items || ! items->text ) { - M_err( "fl_add_nmenu_items2", "Items list NULL or empty" ); + M_err( __func__, "Items list NULL or empty" ); return NULL; } @@ -415,13 +415,13 @@ fl_insert_nmenu_items2( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_add_nmenu_items2", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } if ( ! items || ! items->text ) { - M_err( "fl_insert_nmenu_items2", "Items list NULL or empty" ); + M_err( __func__, "Items list NULL or empty" ); return NULL; } @@ -433,7 +433,7 @@ fl_insert_nmenu_items2( FL_OBJECT * obj, if ( after != NULL && fli_check_popup_entry_exists( after ) != 0 ) { - M_err( "fl_add_nmenu_items2", "Item to insert after doesn't exist" ); + M_err( __func__, "Item to insert after doesn't exist" ); return NULL; } @@ -458,13 +458,13 @@ fl_replace_nmenu_items2( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_replace_nmenu_items2", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } if ( ! items || ! items->text ) { - M_err( "fl_replace_nmenu_items2", "Items list NULL or empty" ); + M_err( __func__, "Items list NULL or empty" ); return NULL; } @@ -478,7 +478,7 @@ fl_replace_nmenu_items2( FL_OBJECT * obj, if ( fli_check_popup_entry_exists( old_item ) ) { - M_err( "fl_replace_nmenu_item2", "Item to replace doesn't exist" ); + M_err( __func__, "Item to replace doesn't exist" ); return NULL; } @@ -513,7 +513,7 @@ fl_get_nmenu_popup( FL_OBJECT * obj ) if ( obj == NULL ) { - M_err( "fl_get_nmenu_popup", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -542,7 +542,7 @@ fl_set_nmenu_popup( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_nmenu_popup", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -552,7 +552,7 @@ fl_set_nmenu_popup( FL_OBJECT * obj, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_set_nmenu_popup", "Popup doesn't exist" ); + M_err( __func__, "Popup doesn't exist" ); return -1; } @@ -560,7 +560,7 @@ fl_set_nmenu_popup( FL_OBJECT * obj, if ( popup->parent != NULL ) { - M_err( "fl_set_nmenu_popup", "Popup is a sub-popup" ); + M_err( __func__, "Popup is a sub-popup" ); return -1; } @@ -595,13 +595,13 @@ fl_set_nmenu_policy( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_nmenu_policy", "NULL object" ); + M_err( __func__, "NULL object" ); return INT_MIN; } if ( policy < FL_POPUP_NORMAL_SELECT || policy > FL_POPUP_DRAG_SELECT ) { - M_err( "fl_set_nmenu_policy", "Invalid policy argument" ); + M_err( __func__, "Invalid policy argument" ); return -1; } @@ -627,7 +627,7 @@ fl_get_nmenu_item( FL_OBJECT * obj ) { if ( obj == NULL ) { - M_err( "fl_get_nmenu_item", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -646,7 +646,7 @@ fl_get_nmenu_item_by_value( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_nmenu_item_by_value", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -671,7 +671,7 @@ fl_get_nmenu_item_by_label( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_nmenu_item_by_label", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -696,7 +696,7 @@ fl_get_nmenu_item_by_text( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_nmenu_item_by_text", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -722,13 +722,13 @@ fl_set_nmenu_hl_text_color(FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_nmenu_hl_text_color", "NULL object" ); + M_err( __func__, "NULL object" ); return FL_MAX_COLORS; } if ( color >= FL_MAX_COLORS ) { - M_err( "fl_set_nmenu_hl_text_color", "Invalid color argument" ); + M_err( __func__, "Invalid color argument" ); return FL_MAX_COLORS; } diff --git a/lib/pixmap.c b/lib/pixmap.c index c7d19c7..c663c60 100644 --- a/lib/pixmap.c +++ b/lib/pixmap.c @@ -144,13 +144,13 @@ cleanup_xpma_struct( XpmAttributes * xpma ) /* do we use at least libXpm 3.4g? */ #if XpmFormat >= 3 && XpmVersion >= 4 && XpmRevision >= 7 - M_warn( "cleanup_xpma_struct", "Using 3.4g features" ); + M_warn( __func__, "Using 3.4g features" ); XFreeColors( flx->display, xpma->colormap, xpma->alloc_pixels, xpma->nalloc_pixels, 0 ); #else /* somewhat dangerous */ - M_warn( "cleanup_xpma_struct", "Using old xpm libs" ); + M_warn( __func__, "Using old xpm libs" ); XFreeColors( flx->display, xpma->colormap, xpma->pixels, xpma->npixels, 0 ); #endif @@ -222,8 +222,7 @@ change_pixmap( FL_BUTTON_STRUCT * sp, sp->pixmap = p; sp->mask = shape_mask; - M_warn( "change_pixmap", "Pixmap = %ld mask = %ld win = %ld", - p, shape_mask, win ); + M_warn( __func__, "Pixmap = %ld mask = %ld win = %ld", p, shape_mask, win ); if ( psp->gc == None ) { @@ -423,7 +422,7 @@ handle_pixmap( FL_OBJECT * obj, FL_BUTTON_STRUCT *sp = obj->spec; #if FL_DEBUG >= ML_DEBUG - M_info( "handle_pixmap", fli_event_name( event ) ); + M_info( __func__, fli_event_name( event ) ); #endif switch ( event ) @@ -526,7 +525,7 @@ create_from_pixmapdata( Window win, if ( s != XpmSuccess ) { errno = 0; - M_err( "fl_create_from_pixmapdata", "error converting: %s", + M_err( __func__, "error converting: %s", ( s == XpmOpenFailed ? "(Can't open)" : ( s == XpmFileInvalid ? "(Invalid file)" : ( s == XpmColorFailed ? "(Can't get color)" : "" ) ) ) ); @@ -615,7 +614,7 @@ fl_get_pixmap_pixmap( FL_OBJECT * obj, if ( ! ( IsValidClass( obj, FL_PIXMAP ) || IsValidClass( obj, FL_PIXMAPBUTTON ) ) ) { - M_err( "fl_get_pixmap_pixmap", "%s is not Pixmap/pixmapbutton class", + M_err( __func__, "%s is not Pixmap/pixmapbutton class", ( obj && obj->label ) ? obj->label : "" ); return None; } @@ -655,7 +654,7 @@ read_pixmapfile( Window win, if ( s != XpmSuccess ) { errno = 0; - M_err( "fl_read_pixmapfile", "error reading %s %s", file, + M_err( __func__, "error reading %s %s", file, ( s == XpmOpenFailed ? "(Can't open)" : ( s == XpmFileInvalid ? "(Invalid file)" : ( s == XpmColorFailed ? "(Can't get color)" : "" ) ) ) ); diff --git a/lib/popup.c b/lib/popup.c index 76bc115..33332f1 100644 --- a/lib/popup.c +++ b/lib/popup.c @@ -814,7 +814,7 @@ fl_popup_add_items( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_add_items", "Popup does not exist" ); + M_err( __func__, "Popup does not exist" ); return NULL; } @@ -855,7 +855,7 @@ fl_popup_delete( FL_POPUP * popup ) if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_delete", "Popup does not exist" ); + M_err( __func__, "Popup does not exist" ); return -1; } @@ -863,7 +863,7 @@ fl_popup_delete( FL_POPUP * popup ) if ( popup->win != None ) { - M_err( "fl_popup_delete", "Can't free popup that is still shown" ); + M_err( __func__, "Can't free popup that is still shown" ); return -1; } @@ -902,7 +902,7 @@ fl_popup_entry_delete( FL_POPUP_ENTRY * entry ) { if ( entry == NULL ) { - M_err( "fl_popup_entry_delete", "Invalid argument" ); + M_err( __func__, "Invalid argument" ); return -1; } @@ -910,7 +910,7 @@ fl_popup_entry_delete( FL_POPUP_ENTRY * entry ) if ( entry->popup->win != None ) { - M_err( "fl_popup_entry_delete", "Can't free entry of a popup that is " + M_err( __func__, "Can't free entry of a popup that is " "shown" ); return -1; } @@ -954,7 +954,7 @@ fl_popup_do( FL_POPUP * popup ) if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_do", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return NULL; } @@ -962,7 +962,7 @@ fl_popup_do( FL_POPUP * popup ) if ( popup->parent != NULL ) { - M_err( "fl_popup_do", "Can't do direct interaction with sub-popup" ); + M_err( __func__, "Can't do direct interaction with sub-popup" ); return NULL; } @@ -984,7 +984,7 @@ fl_popup_set_position( FL_POPUP * popup, { if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_position", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return; } @@ -1007,7 +1007,7 @@ fl_popup_get_policy( FL_POPUP * popup ) if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_get_title_font", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return -1; } @@ -1028,7 +1028,7 @@ fl_popup_set_policy( FL_POPUP * popup, if ( policy < FL_POPUP_NORMAL_SELECT || policy > FL_POPUP_DRAG_SELECT ) { - M_err( "fl_popup_set_policy", "Invalid policy argument" ); + M_err( __func__, "Invalid policy argument" ); return -1; } @@ -1041,7 +1041,7 @@ fl_popup_set_policy( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_policy", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return -1; } @@ -1069,7 +1069,7 @@ fl_popup_entry_set_text( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_text", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return -1; } @@ -1077,7 +1077,7 @@ fl_popup_entry_set_text( FL_POPUP_ENTRY * entry, if ( text == NULL ) { - M_err( "fl_popup_entry_set_text", "Invalid text argument" ); + M_err( __func__, "Invalid text argument" ); return -1; } @@ -1134,7 +1134,7 @@ fl_popup_entry_set_text( FL_POPUP_ENTRY * entry, fli_safe_free( entry->text ); fli_safe_free( entry->label ); fli_safe_free( entry->accel ); - M_err( "fl_popup_entry_set_text", "Running out of memory" ); + M_err( __func__, "Running out of memory" ); } for ( old_sc = entry->shortcut; *old_sc != 0; old_sc++ ) @@ -1163,7 +1163,7 @@ fl_popup_entry_set_shortcut( FL_POPUP_ENTRY * entry, { if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_shortcut", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return; } @@ -1188,7 +1188,7 @@ fl_popup_set_callback( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_callback", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return NULL; } @@ -1207,7 +1207,7 @@ fl_popup_get_title( FL_POPUP * popup ) { if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_title", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return NULL; } @@ -1225,7 +1225,7 @@ fl_popup_set_title( FL_POPUP * popup, { if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_title", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return NULL; } @@ -1236,7 +1236,7 @@ fl_popup_set_title( FL_POPUP * popup, popup->title = fl_strdup( title ); if ( popup->title == NULL ) { - M_err( "fl_popup_set_title", "Running out of memory" ); + M_err( __func__, "Running out of memory" ); return NULL; } } @@ -1286,7 +1286,7 @@ fl_popup_get_title_font( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_get_title_font", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return; } @@ -1315,7 +1315,7 @@ fl_popup_set_title_font( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_title_font", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return; } @@ -1347,7 +1347,7 @@ fl_popup_entry_get_font( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_entry_get_font", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return; } @@ -1376,7 +1376,7 @@ fl_popup_entry_set_font( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_entry_set_font", "Invalid popup" ); + M_err( __func__, "Invalid popup" ); return; } @@ -1401,7 +1401,7 @@ fl_popup_get_bw( FL_POPUP * popup ) if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_get_bw", "Invalid argument" ); + M_err( __func__, "Invalid argument" ); return popup_bw; } @@ -1425,8 +1425,7 @@ fl_popup_set_bw( FL_POPUP * popup, if ( bw == 0 || FL_abs( bw ) > FL_MAX_BW ) { bw = bw == 0 ? -1 : ( bw > 0 ? FL_MAX_BW : - FL_MAX_BW ); - M_warn( "fl_popup_set_bw", "Adjusting invalid border width to %d", - bw ); + M_warn( __func__, "Adjusting invalid border width to %d", bw ); } if ( popup == NULL ) @@ -1438,7 +1437,7 @@ fl_popup_set_bw( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_bw", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return INT_MIN; } @@ -1465,7 +1464,7 @@ fl_popup_get_color( FL_POPUP * popup, if ( popup != NULL && fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_get_color", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); popup = NULL; } @@ -1499,7 +1498,7 @@ fl_popup_get_color( FL_POPUP * popup, } - M_err( "fl_popup_get_color", "Invalid color type argument" ); + M_err( __func__, "Invalid color type argument" ); return FL_BLACK; } @@ -1519,13 +1518,13 @@ fl_popup_set_color( FL_POPUP * popup, if ( popup != NULL && fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_color", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return FL_MAX_COLORS; } if ( color >= FL_MAX_COLORS ) { - M_err( "fl_popup_set_color", "Invalid color argument" ); + M_err( __func__, "Invalid color argument" ); return FL_MAX_COLORS; } @@ -1623,7 +1622,7 @@ fl_popup_set_color( FL_POPUP * popup, break; default : - M_err( "fl_popup_set_color", "Invalid color type argument" ); + M_err( __func__, "Invalid color type argument" ); return FL_MAX_COLORS; } @@ -1648,7 +1647,7 @@ fl_popup_set_cursor( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_set_cursor", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return; } @@ -1671,7 +1670,7 @@ fl_popup_entry_set_callback( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_enter_callback", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return NULL; } @@ -1693,7 +1692,7 @@ fl_popup_entry_set_enter_callback( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_enter_callback", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return NULL; } @@ -1715,7 +1714,7 @@ fl_popup_entry_set_leave_callback( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_leave_callback", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return NULL; } @@ -1734,7 +1733,7 @@ fl_popup_entry_get_state( FL_POPUP_ENTRY * entry ) { if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_get_state", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return UINT_MAX; } @@ -1754,7 +1753,7 @@ fl_popup_entry_set_state( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_state", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return UINT_MAX; } @@ -1817,7 +1816,7 @@ fl_popup_entry_clear_state( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_clear_state", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return UINT_MAX; } @@ -1847,7 +1846,7 @@ fl_popup_entry_raise_state( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_raise_state", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return UINT_MAX; } @@ -1877,7 +1876,7 @@ fl_popup_entry_toggle_state( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_toggle_state", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return UINT_MAX; } @@ -1903,7 +1902,7 @@ fl_popup_entry_set_value( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_value", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return INT_MIN; } @@ -1925,7 +1924,7 @@ fl_popup_entry_set_user_data( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_user_data", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return NULL; } @@ -1945,7 +1944,7 @@ fl_popup_entry_get_group( FL_POPUP_ENTRY * entry ) { if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_get_group", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return INT_MAX; } @@ -1967,7 +1966,7 @@ fl_popup_entry_set_group( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_group", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return INT_MAX; } @@ -2003,13 +2002,13 @@ fl_popup_entry_get_subpopup( FL_POPUP_ENTRY * entry ) { if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_get_subpopup", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return NULL; } if ( entry->type != FL_POPUP_SUB ) { - M_err( "fl_popup_entry_get_subpopup", "Entry isn't a subpopup entry" ); + M_err( __func__, "Entry isn't a subpopup entry" ); return NULL; } @@ -2030,13 +2029,13 @@ fl_popup_entry_set_subpopup( FL_POPUP_ENTRY * entry, if ( fli_check_popup_entry_exists( entry ) ) { - M_err( "fl_popup_entry_set_subpopup", "Invalid entry argument" ); + M_err( __func__, "Invalid entry argument" ); return NULL; } if ( entry->type != FL_POPUP_SUB ) { - M_err( "fl_popup_entry_set_subpopup", "Entry isn't a subpopup entry" ); + M_err( __func__, "Entry isn't a subpopup entry" ); return NULL; } @@ -2045,8 +2044,8 @@ fl_popup_entry_set_subpopup( FL_POPUP_ENTRY * entry, if ( entry->sub->win != None || subpopup->win != None ) { - M_err( "fl_popup_entry_set_subpopup", "Can't change sub-popup while " - "entries sub-popup is shown."); + M_err( __func__, "Can't change sub-popup while entries sub-popup is " + "shown"); return NULL; } @@ -2055,7 +2054,7 @@ fl_popup_entry_set_subpopup( FL_POPUP_ENTRY * entry, if ( check_sub( entry ) ) { entry->sub = old_sub; - M_err( "fl_popup_entry_set_subpopup", "Invalid sub-popup argument" ); + M_err( __func__, "Invalid sub-popup argument" ); return NULL; } @@ -2078,7 +2077,7 @@ fl_popup_entry_get_by_position( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_entry_get_by_position", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return NULL; } @@ -2108,7 +2107,7 @@ fl_popup_entry_get_by_value( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_entry_get_by_value", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return NULL; } @@ -2142,7 +2141,7 @@ fl_popup_entry_get_by_user_data( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_entry_get_by_value", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return NULL; } @@ -2176,7 +2175,7 @@ fl_popup_entry_get_by_text( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_entry_get_by_text", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return NULL; } @@ -2229,7 +2228,7 @@ fl_popup_entry_get_by_label( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_entry_get_by_label", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return NULL; } @@ -2280,7 +2279,7 @@ fl_popup_get_size( FL_POPUP * popup, { if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_get_size", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return -1; } @@ -2303,7 +2302,7 @@ fl_popup_get_min_width( FL_POPUP * popup ) { if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_get_size", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return -1; } @@ -2326,7 +2325,7 @@ fl_popup_set_min_width( FL_POPUP * popup, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_popup_get_size", "Invalid popup argument" ); + M_err( __func__, "Invalid popup argument" ); return -1; } @@ -3314,11 +3313,11 @@ grab( FL_POPUP * popup ) if ( XGrabPointer( flx->display, popup->win, False, evmask, GrabModeAsync, GrabModeAsync, None, popup->cursor, CurrentTime ) != GrabSuccess ) - M_err( "grab", "Can't grab pointer" ); + M_err( __func__, "Can't grab pointer" ); else if ( XGrabKeyboard( flx->display, popup->win, False, GrabModeAsync, GrabModeAsync, CurrentTime ) != GrabSuccess ) { - M_err( "grab", "Can't grab keyboard" ); + M_err( __func__, "Can't grab keyboard" ); XUngrabPointer( flx->display, CurrentTime ); } } diff --git a/lib/positioner.c b/lib/positioner.c index 37c1e38..37703fd 100644 --- a/lib/positioner.c +++ b/lib/positioner.c @@ -527,8 +527,7 @@ fl_set_positioner_xbounds( FL_OBJECT * obj, if ( min == max ) { - M_err( "fl_set_positioner_xbounds", - "Minimum and maximum value are identical" ); + M_err( __func__, "Minimum and maximum value are identical" ); return; } @@ -568,8 +567,7 @@ fl_set_positioner_ybounds( FL_OBJECT * obj, if ( min == max ) { - M_err( "fl_set_positioner_ybounds", - "Minimum and maximum value are identical" ); + M_err( __func__, "Minimum and maximum value are identical" ); return; } @@ -736,7 +734,7 @@ fl_get_positioner_mouse_buttons( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_get_positioner_mouse_buttons", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -794,7 +792,7 @@ fl_set_positioner_validator( FL_OBJECT * obj, ret = validator( obj, sp->xval, sp->yval, &x, &y ); if ( ret == FL_POSITIONER_INVALID ) - M_warn( "fl_set_positioner_validator", + M_warn( __func__, "Current positioner values not within valid range" ); else if ( ret == FL_POSITIONER_REPLACED ) { diff --git a/lib/scrollbar.c b/lib/scrollbar.c index e490f3b..1d951dd 100644 --- a/lib/scrollbar.c +++ b/lib/scrollbar.c @@ -365,7 +365,7 @@ fl_create_scrollbar( int type, sp->slider = fl_create_slider( FL_VERT_NICE_SLIDER2, 1, 1, 1, 1, "" ); else - M_err( "fl_create_scrollbar", "Unknown type %d", type ); + M_err( __func__, "Unknown type %d", type ); fl_set_object_resize( sp->slider, FL_RESIZE_NONE ); } @@ -436,8 +436,7 @@ fl_get_scrollbar_value( FL_OBJECT * obj ) if ( ! ISSCROLLBAR( obj ) ) { - M_err( "fl_get_scrollbar_value", "%s not a scrollbar", - obj ? obj->label : "Object" ); + M_err( __func__, "object %s not a scrollbar", obj ? obj->label : "" ); return - HUGE_VAL; } @@ -456,8 +455,7 @@ fl_set_scrollbar_value( FL_OBJECT * obj, if ( ! ISSCROLLBAR( obj ) ) { - M_err( "fl_set_scrollbar_value", "%s not a scrollbar", - obj ? obj->label : "Object" ); + M_err( __func__, "object %s not a scrollbar", obj ? obj->label : "" ); return; } @@ -535,8 +533,8 @@ fl_set_scrollbar_bounds( FL_OBJECT * obj, if ( ! ISSCROLLBAR( obj ) ) { - M_err( "fl_set_scrollbar_bounds", "%s not a scrollbar", - obj ? obj->label : "Object" ); + M_err( __func__, "object %s not a scrollbar", + obj ? obj->label : "" ); return; } diff --git a/lib/select.c b/lib/select.c index d895f84..0a8f9eb 100644 --- a/lib/select.c +++ b/lib/select.c @@ -121,7 +121,7 @@ fl_clear_select( FL_OBJECT * obj ) if ( obj == NULL ) { - M_err( "fl_clear_select_popup", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -162,7 +162,7 @@ fl_add_select_items( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_add_select_items", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -206,7 +206,7 @@ fl_insert_select_items( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_add_select_items", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -218,7 +218,7 @@ fl_insert_select_items( FL_OBJECT * obj, if ( after != NULL && fli_check_popup_entry_exists( after ) != 0 ) { - M_err( "fl_add_select_items", "Item to insert after doesn't exist" ); + M_err( __func__, "Item to insert after doesn't exist" ); return NULL; } @@ -254,13 +254,13 @@ fl_replace_select_item( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_replace_select_items", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } if ( ! items || ! *items ) { - M_err( "fl_replace_select_items", "Items string NULL or empty" ); + M_err( __func__, "Items string NULL or empty" ); return NULL; } @@ -274,7 +274,7 @@ fl_replace_select_item( FL_OBJECT * obj, if ( fli_check_popup_entry_exists( old_item ) ) { - M_err( "fl_replace_select_items", "Item to replace doesn't exist" ); + M_err( __func__, "Item to replace doesn't exist" ); return NULL; } @@ -319,7 +319,7 @@ fl_delete_select_item( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_delete_select_item", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -331,7 +331,7 @@ fl_delete_select_item( FL_OBJECT * obj, if ( fli_check_popup_entry_exists( item ) != 0 ) { - M_err( "fl_delete_select_item", "Item doesn't exist" ); + M_err( __func__, "Item doesn't exist" ); return -1; } @@ -365,7 +365,7 @@ fl_set_select_items( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_select_items", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -459,7 +459,7 @@ fl_set_select_popup( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_select_popup", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -469,7 +469,7 @@ fl_set_select_popup( FL_OBJECT * obj, if ( fli_check_popup_exists( popup ) ) { - M_err( "fl_set_select_popup", "Popup doesn't exist" ); + M_err( __func__, "Popup doesn't exist" ); return -1; } @@ -478,14 +478,14 @@ fl_set_select_popup( FL_OBJECT * obj, if ( popup->parent != NULL ) { - M_err( "fl_set_select_popup", "Popup is a sub-popup" ); + M_err( __func__, "Popup is a sub-popup" ); return -1; } for ( e = popup->entries; e != NULL; e = e->next ) if ( e->type != FL_POPUP_NORMAL ) { - M_err( "fl_set_select_popup", "Invalid entries in popup" ); + M_err( __func__, "Invalid entries in popup" ); return -1; } @@ -516,7 +516,7 @@ fl_get_select_item( FL_OBJECT * obj ) { if ( obj == NULL ) { - M_err( "fl_get_select_item", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -538,13 +538,13 @@ fl_set_select_item( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_select_item", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } if ( entry == NULL ) { - M_err( "fl_set_select_item", "NULL entry" ); + M_err( __func__, "NULL entry" ); return NULL; } @@ -560,13 +560,13 @@ fl_set_select_item( FL_OBJECT * obj, if ( e == NULL ) { - M_err( "fl_set_select_item", "Entry does not exist" ); + M_err( __func__, "Entry does not exist" ); return NULL; } if ( ! IS_ACTIVATABLE( entry ) ) { - M_err( "fl_set_select_item", "Entry can't be set as selected" ); + M_err( __func__, "Entry can't be set as selected" ); return NULL; } @@ -587,7 +587,7 @@ fl_get_select_item_by_value( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_select_item_by_value", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -612,7 +612,7 @@ fl_get_select_item_by_label( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_select_item_by_label", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -655,7 +655,7 @@ fl_get_select_item_by_text( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_select_item_by_text", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -698,7 +698,7 @@ fl_get_select_text_color( FL_OBJECT * obj ) if ( obj == NULL ) { - M_err( "fl_get_select_color", "NULL object" ); + M_err( __func__, "NULL object" ); return FL_MAX_COLORS; } @@ -721,13 +721,13 @@ fl_set_select_text_color( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_select_color", "NULL object" ); + M_err( __func__, "NULL object" ); return FL_MAX_COLORS; } if ( color >= FL_MAX_COLORS ) { - M_err( "fl_select_set_color", "Invalid color argument" ); + M_err( __func__, "Invalid color argument" ); return FL_MAX_COLORS; } @@ -754,7 +754,7 @@ fl_get_select_text_font( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_get_select_font", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -782,7 +782,7 @@ fl_set_select_text_font( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_select_font", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -805,7 +805,7 @@ fl_get_select_text_align( FL_OBJECT * obj ) { if ( obj == NULL ) { - M_err( "fl_set_select_text_align", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -826,20 +826,20 @@ fl_set_select_text_align( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_select_text_align", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } if ( fl_is_outside_lalign( align ) ) { - M_warn( "fl_set_select_text_align", "Adding FL_ALIGN_INSIDE flag" ); + M_warn( __func__, "Adding FL_ALIGN_INSIDE flag" ); align = fl_to_inside_lalign( align ); } if ( fl_to_outside_lalign( align ) < FL_ALIGN_CENTER || fl_to_outside_lalign( align ) > FL_ALIGN_RIGHT_BOTTOM ) { - M_err( "fl_set_select_text_align", "Invalid value for align" ); + M_err( __func__, "Invalid value for align" ); return -1; } @@ -866,13 +866,13 @@ fl_set_select_policy( FL_OBJECT * obj, if ( obj == NULL ) { - M_err( "fl_set_select_policy", "NULL object" ); + M_err( __func__, "NULL object" ); return INT_MIN; } if ( policy < FL_POPUP_NORMAL_SELECT || policy > FL_POPUP_DRAG_SELECT ) { - M_err( "fl_set_select_policy", "Invalid policy argument" ); + M_err( __func__, "Invalid policy argument" ); return -1; } diff --git a/lib/signal.c b/lib/signal.c index 3c1130e..6a3678f 100644 --- a/lib/signal.c +++ b/lib/signal.c @@ -140,8 +140,7 @@ fl_add_signal_callback( int s, if ( sig_rec->ocallback == ( FLI_OSSIG_HANDLER ) - 1L || errno ) #endif { - M_err( "fl_add_signal_callback", "Can't add handler for " - "signal %d", s ); + M_err( __func__, "Can't add handler for signal %d", s ); fl_free( sig_rec ); return; } @@ -168,8 +167,7 @@ fl_remove_signal_callback( int s ) if ( ! rec ) { - M_err( "fl_remove_signal_callback", "No handler exists for signal %d", - s ); + M_err( __func__, "No handler exists for signal %d", s ); return; } @@ -204,7 +202,7 @@ fl_signal_caught( int s ) if ( ! rec ) { - M_err( "fl_signal_caught", "Caught bogus signal %d", s ); + M_err( __func__, "Caught bogus signal %d", s ); return; } diff --git a/lib/sldraw.c b/lib/sldraw.c index 263e9c9..6c37d83 100644 --- a/lib/sldraw.c +++ b/lib/sldraw.c @@ -159,7 +159,7 @@ fli_calc_slider_size( FL_OBJECT * ob, return; } - M_err( "fli_calc_slider_size", "Bad slider type:%d", ob->type ); + M_err( __func__, "Bad slider type:%d", ob->type ); } diff --git a/lib/slider.c b/lib/slider.c index e8a83ba..df4cc10 100644 --- a/lib/slider.c +++ b/lib/slider.c @@ -936,8 +936,7 @@ fl_set_slider_value( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_SLIDER ) && ! IsValidClass( ob, FL_VALSLIDER ) ) { - M_err( "fl_set_slider_value", "%s is not a slider", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not a slider", ob ? ob->label : "" ); return; } #endif @@ -968,8 +967,7 @@ fl_set_slider_bounds( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_SLIDER ) && ! IsValidClass( ob, FL_VALSLIDER ) ) { - M_err( "fl_set_slider_bounds", "%s is not a slider", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not a slider", ob ? ob->label : "" ); return; } #endif @@ -999,8 +997,7 @@ fl_get_slider_value( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_SLIDER ) && ! IsValidClass( ob, FL_VALSLIDER ) ) { - M_err( "fl_get_slider_value", "%s is not a slider", - ob ? ob->label : "" ); + M_err( __func__, "object %s is not a slider", ob ? ob->label : "" ); return 0; } #endif @@ -1214,7 +1211,7 @@ fl_get_slider_mouse_buttons( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_get_slider_mouse_buttons", "NULL object" ); + M_err( __func__, "NULL object" ); return; } diff --git a/lib/symbols.c b/lib/symbols.c index 54cef06..0e008f3 100644 --- a/lib/symbols.c +++ b/lib/symbols.c @@ -120,7 +120,7 @@ fl_add_symbol( const char * name, || *name == '@' || ! drawit ) { - M_warn( "fl_add_symbol", "Invalid argument" ); + M_warn( __func__, "Invalid argument" ); return 0; } @@ -130,7 +130,7 @@ fl_add_symbol( const char * name, symbols = s; else { - M_warn( "fl_add_symbol", "Out of memory" ); + M_warn( __func__, "Out of memory" ); return 0; } @@ -257,7 +257,7 @@ fl_draw_symbol( const char * label, if ( ! ( s = find_symbol( label + pos ) ) ) { - M_err( "fl_draw_symbol", "Bad symbol: \"%s\"", label ); + M_err( __func__, "Bad symbol: \"%s\"", label ); return 0; } diff --git a/lib/tabfolder.c b/lib/tabfolder.c index f2b79be..01f0b9a 100644 --- a/lib/tabfolder.c +++ b/lib/tabfolder.c @@ -335,7 +335,7 @@ switch_folder( FL_OBJECT * ob, if ( data < 0 || data >= sp->nforms ) { - M_err( "switch_folder", "Invalid index"); + M_err( __func__, "Invalid index"); return; } @@ -463,21 +463,20 @@ fl_addto_tabfolder( FL_OBJECT * ob, if ( ! IsFolderClass( ob ) ) { - M_err( "fl_addto_tabfolder", "%s not a folder class", + M_err( __func__, "object %s not a folder class", ob ? ob->label : "null" ); return 0; } if ( ! form || ! title ) { - M_err( "fl_addto_tabfolder", "Invalid argument(s)" ); + M_err( __func__, "Invalid argument(s)" ); return 0; } if ( form->attached ) { - M_err( "fl_addto_tabfolder", - "Seems as if the form is already attached" ); + M_err( __func__, "Seems as if the form is already attached" ); return 0; } @@ -737,7 +736,7 @@ fl_set_folder( FL_OBJECT * ob, if ( ! IsFolderClass( ob ) ) { - M_err( "fl_set_folder", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return; } @@ -765,7 +764,7 @@ fl_set_folder_byname( FL_OBJECT * ob, if ( ! IsFolderClass( ob ) ) { - M_err( "fl_set_folder_byname", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return; } @@ -808,7 +807,7 @@ fl_set_folder_bynumber( FL_OBJECT * ob, if ( ! IsFolderClass( ob ) ) { - M_err( "fl_set_folder_bynumber", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return; } @@ -852,7 +851,7 @@ fl_get_folder_number( FL_OBJECT * ob ) { if ( ! IsFolderClass( ob ) ) { - M_err( "fl_get_folder_number", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return 0; } @@ -869,7 +868,7 @@ fl_get_active_folder_number( FL_OBJECT * ob ) { if ( ! IsFolderClass( ob ) ) { - M_err( "fl_get_active_folder_number", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return 0; } @@ -888,7 +887,7 @@ fl_get_folder( FL_OBJECT * ob ) if ( ! IsFolderClass( ob ) ) { - M_err( "fl_get_folder", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return NULL; } @@ -908,7 +907,7 @@ fl_get_folder_name( FL_OBJECT * ob ) if ( ! IsFolderClass( ob ) ) { - M_err( "fl_get_folder_name", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return NULL; } @@ -928,7 +927,7 @@ fl_get_active_folder( FL_OBJECT * ob ) if ( ! IsFolderClass( ob ) ) { - M_err( "fl_get_active_folder", "%s is not tabfolder", + M_err( __func__, "object %s is not tabfolder", ob ? ob->label : "null" ); return NULL; } @@ -950,8 +949,8 @@ fl_get_active_folder_name( FL_OBJECT * ob ) if ( ! IsFolderClass( ob ) ) { - M_err( "fl_get_active_folder_name", "%s is not tabfolder", - ob ? ob->label : "null" ); + M_err( __func__, "object %s is not tabfolder", + ob ? ob->label : "null" ); return NULL; } @@ -446,14 +446,14 @@ fli_tbox_insert_line( FL_OBJECT * obj, if ( p[ 2 ] == '0円' ) tl->incomp_esc = 1; else - M_err( "fli_tbox_insert_line", "missing color" ); + M_err( __func__, "missing color" ); p += 1; break; } if ( tl->color >= FL_MAX_COLS ) { - M_err( "fli_tbox_insert_line", "bad color %ld", tl->color ); + M_err( __func__, "bad color %ld", tl->color ); tl->color = obj->lcol; } p = e; @@ -464,7 +464,7 @@ fli_tbox_insert_line( FL_OBJECT * obj, break; default : - M_err( "fli_tbox_insert_line", "bad flag %c", p[ 1 ] ); + M_err( __func__, "bad flag %c", p[ 1 ] ); p += 1; done = 1; break; diff --git a/lib/thumbwheel.c b/lib/thumbwheel.c index bf02cc4..fa04261 100644 --- a/lib/thumbwheel.c +++ b/lib/thumbwheel.c @@ -319,8 +319,7 @@ fl_get_thumbwheel_value( FL_OBJECT * ob ) #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_THUMBWHEEL ) ) { - M_err( "fl_get_thumbwheel_value", "%s is not a thumbwheel", - ob ? ob->label : "null" ); + M_err( __func__, "object %s is not a thumbwheel", ob ? ob->label : "" ); return 1.0; } #endif @@ -342,8 +341,7 @@ fl_set_thumbwheel_value( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_THUMBWHEEL ) ) { - M_err( "fl_set_thumbwheel_value", "%s is not a thumbwheel", - ob ? ob->label : "null" ); + M_err( __func__, "object %s is not a thumbwheel", ob ? ob->label : "" ); return 1.0; } #endif @@ -375,8 +373,7 @@ fl_set_thumbwheel_bounds( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_THUMBWHEEL ) ) { - M_err( "fl_set_thumbwheel_bounds", "%s is not a thumbwheel", - ob ? ob->label : "null" ); + M_err( __func__, "object %s is not a thumbwheel", ob ? ob->label : "" ); return; } #endif diff --git a/lib/timeout.c b/lib/timeout.c index 05bfdbd..ec0faf2 100644 --- a/lib/timeout.c +++ b/lib/timeout.c @@ -119,7 +119,7 @@ fl_remove_timeout( int id ) if ( rec ) remove_timeout( rec ); else - M_err( "fl_remove_timeout", "ID %d not found", id ); + M_err( __func__, "ID %d not found", id ); } @@ -227,7 +227,7 @@ fli_read_line( FILE *fp ) if ( ( line = fl_realloc( line, len ) ) == NULL ) { fli_safe_free( old_line ); - M_err( "fli_read_line", "Running out of memory\n" ); + M_err( __func__, "Running out of memory\n" ); return NULL; } @@ -235,7 +235,7 @@ fli_read_line( FILE *fp ) { if ( ferror( fp ) ) { - M_err( "fli_read_line", "Failed to read from file" ); + M_err( __func__, "Failed to read from file" ); fl_free( line ); return NULL; } @@ -246,7 +246,7 @@ fli_read_line( FILE *fp ) return NULL; } - M_warn( "fli_read_line", "Missing newline at end of line" ); + M_warn( __func__, "Missing newline at end of line" ); break; } @@ -339,7 +339,7 @@ fl_winaspect( Window win, if ( x <= 0 || y <= 0 ) { - M_err( "fl_winaspect", "Bad aspect ratio" ); + M_err( __func__, "Bad aspect ratio" ); return; } @@ -541,7 +541,7 @@ wait_mapwin( Window win ) if ( ! ( st_xswa.event_mask & StructureNotifyMask ) ) { - M_err( "wait_mapwin", "XForms improperly initialized" ); + M_err( __func__, "XForms improperly initialized" ); exit( 1 ); } @@ -585,7 +585,7 @@ get_machine_name( Display * d ) if ( gethostname( machine_name, sizeof machine_name - 1 ) ) { - M_err( "get_machine_name", "Unable to get host name" ); + M_err( __func__, "Unable to get host name" ); strcpy( machine_name, DisplayString( d ) ); if ( ( p = strchr( machine_name, ':' ) ) ) *p = '0円'; diff --git a/lib/xdraw.c b/lib/xdraw.c index 9acfa1e..d9b7c41 100644 --- a/lib/xdraw.c +++ b/lib/xdraw.c @@ -666,7 +666,7 @@ fl_dashedlinestyle( const char * dash, for ( i = 0; i < ndash; i++ ) if ( dash[ i ] == '0円' ) { - M_warn( "fl_dashedlinestyle", "Invalid '0円' in dash pattern " + M_warn( __func__, "Invalid '0円' in dash pattern " "array, using default pattern" ); ndash = 0; break; diff --git a/lib/xpopup.c b/lib/xpopup.c index fe6d0d6..7f0796b 100644 --- a/lib/xpopup.c +++ b/lib/xpopup.c @@ -229,7 +229,7 @@ find_empty_index( Window win ) return p - menu_rec; } - M_err( "find_empty_index", "Too many popups (maximum is %d)", fl_maxpup ); + M_err( __func__, "Too many popups (maximum is %d)", fl_maxpup ); return -1; } @@ -376,13 +376,13 @@ parse_entry( int n, if ( e == p + 2 ) { flags |= M_ERR; - M_err( "parse_entry", "Missing number after %%x" ); + M_err( __func__, "Missing number after %%x" ); break; } if ( num <= 0 ) { flags |= M_ERR; - M_err( "parse_entry", "Invalid zero or negative " + M_err( __func__, "Invalid zero or negative " "number after %%x" ); break; } @@ -411,13 +411,13 @@ parse_entry( int n, if ( num <= 0 ) { flags |= M_ERR; - M_err( "parse_entry", "Zero or negative group number" ); + M_err( __func__, "Zero or negative group number" ); break; } if ( e == p + 2 ) { flags |= M_ERR; - M_err( "parse_entry", "Missing number after %%%c", + M_err( __func__, "Missing number after %%%c", p + 1 ); break; } @@ -448,7 +448,7 @@ parse_entry( int n, default : flags |= M_ERR; - M_err( "parse_entry", "Unknown sequence %%%c", p[ 1 ] ); + M_err( __func__, "Unknown sequence %%%c", p[ 1 ] ); break; } } @@ -462,7 +462,7 @@ parse_entry( int n, if ( sc ) { - M_info( "parse_entry", "shortcut = %s for %s", sc, c ); + M_info( __func__, "shortcut = %s for %s", sc, c ); convert_shortcut( sc, c, item, NSC ); } @@ -508,7 +508,7 @@ parse_entry( int n, } if ( c ) - M_err( "parse_entry", "Too many menu items, max is %d", FL_MAXPUPI ); + M_err( __func__, "Too many menu items, max is %d", FL_MAXPUPI ); fl_free( s ); @@ -669,7 +669,7 @@ fl_newpup( Window win ) if ( pup_level ) { - M_warn( "fl_newpup", "Inconsistent pup_level %d", pup_level ); + M_warn( __func__, "Inconsistent pup_level %d", pup_level ); pup_level = 0; } @@ -767,7 +767,7 @@ requested_item_is_valid( const char * where, { if ( nm < 0 || nm >= fl_maxpup || ! menu_rec[ nm ].used ) { - M_err( where, "Bad popup index %d", nm ); + M_err( __func__, "Bad popup index %d for \"%s\"", nm, where ); return NULL; } @@ -823,8 +823,7 @@ convert_shortcut( const char * sc, item->ulpos = fli_get_underline_pos( str, sc ) - 1; fli_convert_shortcut( sc, item->shortcut ); if ( sc[ 0 ] == '&' ) - M_info( "convert_shortcut", "sc = %s keysym = %ld\n", - sc, item->shortcut[ 0 ] ); + M_info( __func__, "sc = %s keysym = %ld\n", sc, item->shortcut[ 0 ] ); } @@ -886,7 +885,7 @@ get_valid_entry( PopUP * m, if ( ! ( m->item[ target - 1 ]->mode & FL_PUP_GREY ) ) return target; - M_err( "get_valid_entry", "No valid entries among total of %d", m->nitems ); + M_err( __func__, "No valid entries among total of %d", m->nitems ); return 0; } @@ -1257,12 +1256,12 @@ grab_both( PopUP * m ) if ( XGrabPointer( flx->display, m->win, False, evmask, GrabModeAsync, GrabModeAsync, None, m->cursor, CurrentTime ) != GrabSuccess ) - M_err( "grab_both", "Can't grab pointer" ); + M_err( __func__, "Can't grab pointer" ); if ( XGrabKeyboard( flx->display, m->win, False, GrabModeAsync, GrabModeAsync, CurrentTime ) != GrabSuccess ) { - M_err( "grab_both", "Can't grab keyboard" ); + M_err( __func__, "Can't grab keyboard" ); XUngrabPointer( flx->display, CurrentTime ); } } @@ -1282,7 +1281,7 @@ fl_dopup( int n ) if ( n < 0 || n >= fl_maxpup || ! menu_rec[ n ].used ) { - M_err( "fl_dopup", "bad pupID: %d\n", n ); + M_err( __func__, "bad pupID: %d\n", n ); return -1; } @@ -1316,7 +1315,7 @@ fl_dopup( int n ) wait_for_close( m->win ); } else - M_err( "fl_dopup", "Window already closed" ); + M_err( __func__, "Window already closed" ); /* The following is necessary because 'save_under' may not be supported. Both the forms under the closed popup window and higher level popup @@ -1415,7 +1414,7 @@ fl_freepup( int n ) if ( ! p->used ) { - M_warn( "freepup", "freeing an unallocated/free'ed popup %d\n", n ); + M_warn( __func__, "freeing an unallocated/free'ed popup %d\n", n ); return; } @@ -1981,7 +1980,7 @@ fl_showpup( int n ) if ( n < 0 || n >= fl_maxpup || ! menu_rec[ n ].used ) { - M_err( "fl_showpup", "bad pupID: %d\n", n ); + M_err( __func__, "bad pupID: %d\n", n ); return; } diff --git a/lib/xsupport.c b/lib/xsupport.c index 09d9223..2184a63 100644 --- a/lib/xsupport.c +++ b/lib/xsupport.c @@ -54,7 +54,7 @@ fli_check_key_focus( const char * s, if ( fli_cntl.debug > 1 ) { XGetInputFocus( flx->display, &w, &r ); - M_info( "fli_check_key_focus", "%s:%s FWin = %lu ReqW = %lu", + M_info( __func__, "%s:%s FWin = %lu ReqW = %lu", s ? s : "", w == win ? "OK" : "Wrong", w, win ); } } @@ -242,9 +242,9 @@ xerror_handler( Display * d FL_UNUSED_ARG, XErrorEvent * xev ) { if ( xev->error_code == BadAlloc ) - M_err( "xerror_handler", "XError: can't allocate - ignored " ); + M_err( __func__, "XError: can't allocate - ignored " ); else - M_err( "xerror_handler", "XError: %d", xev->error_code ); + M_err( __func__, "XError: %d", xev->error_code ); xerror_detected = 1; return 0; diff --git a/lib/xtext.c b/lib/xtext.c index 64ea315..b7c0602 100644 --- a/lib/xtext.c +++ b/lib/xtext.c @@ -298,7 +298,7 @@ fli_draw_string( int align, break; default : - M_err( "fli_draw_string", "This is impossible" ); + M_err( __func__, "This is impossible" ); return 0; } @@ -318,7 +318,7 @@ fli_draw_string( int align, break; default : - M_err( "fli_draw_string", "This is impossible" ); + M_err( __func__, "This is impossible" ); return 0; } } @@ -639,7 +639,7 @@ fli_get_pos_in_string( int align, break; default : - M_err( "fli_get_pos_in_string", "This is impossible" ); + M_err( __func__, "This is impossible" ); return 0; } @@ -682,7 +682,7 @@ fli_get_pos_in_string( int align, break; default : - M_err( "fli_get_pos_in_string", "This is impossible" ); + M_err( __func__, "This is impossible" ); return 0; } @@ -922,7 +922,7 @@ fl_draw_text_beside( int align, return; if ( fl_is_inside_lalign( align ) && ! fl_is_center_lalign( align ) ) - M_warn( "drw_text_beside", "align request is inside" ); + M_warn( __func__, "align request is inside" ); if ( align & FL_ALIGN_LEFT ) { diff --git a/lib/xyplot.c b/lib/xyplot.c index b325dba..74f839d 100644 --- a/lib/xyplot.c +++ b/lib/xyplot.c @@ -282,8 +282,7 @@ fli_xyplot_interpolate( FL_OBJECT * ob, if ( newn > 5000 ) { - M_err( "fli_xyplot_interpolate", - "interpolating %d points exceeds screen res", newn ); + M_err( __func__, "interpolating %d points exceeds screen res", newn ); return -1; } @@ -304,8 +303,7 @@ fli_xyplot_interpolate( FL_OBJECT * ob, { if ( sp->wx ) fli_safe_free( sp->wx ); - M_err( "fli_xyplot_interpolate", - "Can't allocate memory for %d points", newn ); + M_err( __func__, "Can't allocate memory for %d points", newn ); return -1; } @@ -316,8 +314,7 @@ fli_xyplot_interpolate( FL_OBJECT * ob, sp->wx, sp->wy, sp->grid[ id ], sp->interpolate[ id ] ) != newn ) { - M_err( "fli_xyplot_interpolate", - "An error has occured while interpolating" ); + M_err( __func__, "An error has occured while interpolating" ); return -1; } @@ -2025,7 +2022,7 @@ handle_xyplot( FL_OBJECT * ob, } if ( ret && sp->inside == 0 ) - M_err( "handle_xyplot", "Something is wrong\n" ); + M_err( __func__, "Something is wrong\n" ); return ret; } @@ -2410,7 +2407,7 @@ fl_set_xyplot_symbol( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_set_xyplot_symbol", "ID %d is not in range (0,%d)", + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return NULL; } @@ -2486,8 +2483,8 @@ fl_set_xyplot_xtics( FL_OBJECT * ob, && ( ( minor > 0 && major * minor > MAX_TIC ) || ( minor < 0 && major > MAX_TIC ) ) ) { - M_err( "fl_set_xyplot_xtics", - "More than maximum of %d tics would be required", MAX_TIC ); + M_err( __func__, "More than maximum of %d tics would be required", + MAX_TIC ); if ( minor > 0 ) minor = 2; major = 5; @@ -2531,8 +2528,8 @@ fl_set_xyplot_ytics( FL_OBJECT * ob, && ( ( minor > 0 && major * minor > MAX_TIC ) || ( minor < 0 && major > MAX_TIC ) ) ) { - M_err( "fl_set_xyplot_ytics", - "More than maximum of %d tics would be required", MAX_TIC ); + M_err( __func__, "More than maximum of %d tics would be required", + MAX_TIC ); minor = 2; major = 5; } @@ -2756,8 +2753,7 @@ fl_set_xyplot_data_double( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_XYPLOT ) ) { - M_err( "fl_set_xyplot_data_double", - "%s not an xyplot", ob ? ob->label : "" ); + M_err( __func__, "object %s not an xyplot", ob ? ob->label : "" ); return; } #endif @@ -2779,7 +2775,7 @@ fl_set_xyplot_data_double( FL_OBJECT * ob, { if ( *sp->x ) fl_free( *sp->x ); - M_err( "fl_set_xyplot_data_double", "Can't allocate memory" ); + M_err( __func__, "Can't allocate memory" ); return; } @@ -2817,7 +2813,7 @@ fl_set_xyplot_data( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_XYPLOT ) ) { - M_err( "fl_set_xyplot_data", "%s not an xyplot", ob ? ob->label : "" ); + M_err( __func__, "object %s not an xyplot", ob ? ob->label : "" ); return; } #endif @@ -2839,7 +2835,7 @@ fl_set_xyplot_data( FL_OBJECT * ob, { if ( *sp->x ) fli_safe_free( *sp->x ); - M_err( "fl_set_xyplot_data", "Can't allocate memory" ); + M_err( __func__, "Can't allocate memory" ); return; } @@ -2873,8 +2869,7 @@ fl_insert_xyplot_data( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_insert_xyplot_data", "ID %d is not in range (0,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return; } @@ -2944,8 +2939,7 @@ fl_add_xyplot_overlay( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_XYPLOT ) ) { - M_err( "fl_add_xyplot_overlay", "%s not XYPLOT class", - ob ? ob->label : "" ); + M_err( __func__, "object %s not XYPLOT class", ob ? ob->label : "" ); return; } #endif @@ -2954,8 +2948,7 @@ fl_add_xyplot_overlay( FL_OBJECT * ob, if ( id < 1 || id > sp->maxoverlay ) { - M_err( "fl_add_xyplot_overlay", "ID %d is not in range (1,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (1,%d)", id, sp->maxoverlay ); return; } @@ -3008,7 +3001,7 @@ load_data( const char * f, if ( ! f || ! ( fp = fopen( f, "r" ) ) ) { - M_err( "load_data", "Can't open datafile '%s'", f ? f : "null" ); + M_err( __func__, "Can't open datafile '%s'", f ? f : "null" ); return 0; } @@ -3028,8 +3021,7 @@ load_data( const char * f, if ( ( err = ( sscanf( buf, "%f%*[ \t,]%f", *x + n, *y + n ) != 2 ) ) ) { - M_err( "load_data", "An error occured at line %d", - ++n + ncomment ); + M_err( __func__, "An error occured at line %d", ++n + ncomment ); break; } @@ -3090,8 +3082,7 @@ fl_set_xyplot_overlay_type( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_set_xyplot_overlay_type", "ID %d is not in range (0,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return; } @@ -3114,7 +3105,7 @@ fl_get_xyplot_numdata( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_get_xyplot_numdata", "ID %d is not in range (0,%d)", + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return -1; } @@ -3134,8 +3125,7 @@ fl_delete_xyplot_overlay( FL_OBJECT * ob, if ( id <= 0 || id > sp->maxoverlay ) { - M_err( "fl_delete_xyplot_overlay", "ID %d is not in range (1,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (1,%d)", id, sp->maxoverlay ); return; } @@ -3159,8 +3149,7 @@ fl_get_xyplot_overlay_data( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_get_xyplot_overlay_data", "ID %d is not in range (0,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return; } @@ -3189,8 +3178,7 @@ fl_get_xyplot_data_pointer( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_get_xyplot_data_pointer", "ID %d is not in range (0,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return; } @@ -3218,8 +3206,7 @@ fl_set_xyplot_linewidth( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_set_xyplot_linewidth", "ID %d is not in range (0,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return; } @@ -3248,7 +3235,7 @@ fl_set_xyplot_file( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_XYPLOT ) ) { - M_err( "fl_set_xyplot_file", "%s not an xyplot", ob ? ob->label : "" ); + M_err( __func__, "object %s not an xyplot", ob ? ob->label : "" ); return 0; } #endif @@ -3281,7 +3268,7 @@ fl_add_xyplot_text( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_XYPLOT ) ) { - M_err( "fl_add_xyplot_text", "%s not an xyplot", ob ? ob->label : "" ); + M_err( __func__, "object %s not an xyplot", ob ? ob->label : "" ); return; } #endif @@ -3318,8 +3305,7 @@ fl_delete_xyplot_text( FL_OBJECT * ob, #if FL_DEBUG >= ML_ERR if ( ! IsValidClass( ob, FL_XYPLOT ) ) { - M_err( "fl_delete_xyplot_text", "%s not an xyplot", - ob ? ob->label : "" ); + M_err( __func__, "object %s not an xyplot", ob ? ob->label : "" ); return; } #endif @@ -3509,8 +3495,7 @@ gen_logtic( float tmin, if ( tmin <= 0.0 || tmax <= 0.0 ) { - M_err( "gen_logtic", "range bordrs must be greater than 0 for " - "logscale" ); + M_err( __func__, "range borders must be greater than 0 for logscale" ); return -1; } @@ -3637,7 +3622,7 @@ fl_set_xyplot_xscale( FL_OBJECT * ob, if ( scale == FL_LOG && ( base <= 0.0 || base == 1.0 ) ) { - M_err( "fl_set_xyplot_xscale", "bad log base %g specified", base ); + M_err( __func__, "bad log base %g specified", base ); return; } @@ -3668,7 +3653,7 @@ fl_set_xyplot_yscale( FL_OBJECT * ob, if ( scale == FL_LOG && ( base <= 0.0 || base == 1.0 ) ) { - M_err( "fl_set_xyplot_yscale", "bad log base %g specified", base ); + M_err( __func__, "bad log base %g specified", base ); return; } @@ -3829,8 +3814,7 @@ fl_set_xyplot_key( FL_OBJECT * ob, if ( id < 0 || id > sp->maxoverlay ) { - M_err( "fl_set_xyplot_key", "ID %d is not in range (0,%d)", - id, sp->maxoverlay ); + M_err( __func__, "ID %d is not in range (0,%d)", id, sp->maxoverlay ); return; } @@ -4038,7 +4022,7 @@ fl_get_xyplot_mouse_buttons( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_get_xyplot_mouse_buttons", "NULL object" ); + M_err( __func__, "NULL object" ); return; } |