Cleanups - try to remove stdio.h include where possible

This commit is contained in:
libretroadmin 2023-01-21 22:25:38 +01:00
parent c3fe980a1d
commit 01c3684b10
17 changed files with 84 additions and 92 deletions

View file

@ -14,7 +14,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <math.h> #include <math.h>

View file

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <malloc.h> #include <malloc.h>

View file

@ -15,7 +15,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <math.h> #include <math.h>

View file

@ -14,7 +14,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <math.h> #include <math.h>

View file

@ -16,11 +16,9 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <libretro.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <boolean.h> #include <boolean.h>
@ -140,8 +138,7 @@ bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
num_glyphs = (glyph_max - glyph_min) + 1; num_glyphs = (glyph_max - glyph_min) + 1;
/* Initialise font struct */ /* Initialise font struct */
font = (bitmapfont_lut_t*)calloc(1, sizeof(bitmapfont_lut_t)); if (!(font = (bitmapfont_lut_t*)calloc(1, sizeof(bitmapfont_lut_t))))
if (!font)
goto error; goto error;
font->glyph_min = glyph_min; font->glyph_min = glyph_min;
@ -150,8 +147,7 @@ bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
/* Note: Need to use a calloc() here, otherwise /* Note: Need to use a calloc() here, otherwise
* we'll get undefined behaviour when calling * we'll get undefined behaviour when calling
* bitmapfont_free_lut() if the following loop fails */ * bitmapfont_free_lut() if the following loop fails */
font->lut = (bool**)calloc(1, num_glyphs * sizeof(bool*)); if (!(font->lut = (bool**)calloc(1, num_glyphs * sizeof(bool*))))
if (!font->lut)
goto error; goto error;
/* Loop over all possible characters */ /* Loop over all possible characters */

View file

@ -17,11 +17,9 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <libretro.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <boolean.h> #include <boolean.h>
@ -72,14 +70,11 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
{ {
/* Needed individually for any non-Latin languages */ /* Needed individually for any non-Latin languages */
case RETRO_LANGUAGE_ENGLISH: case RETRO_LANGUAGE_ENGLISH:
{
font_file = FONT_6X10_FILE_ENG; font_file = FONT_6X10_FILE_ENG;
font_size = FONT_6X10_SIZE_ENG; font_size = FONT_6X10_SIZE_ENG;
glyph_min = FONT_6X10_GLYPH_MIN_ENG; glyph_min = FONT_6X10_GLYPH_MIN_ENG;
glyph_max = FONT_6X10_GLYPH_MAX_ENG; glyph_max = FONT_6X10_GLYPH_MAX_ENG;
break; break;
}
/* All Latin alphabet languages go here */ /* All Latin alphabet languages go here */
case RETRO_LANGUAGE_FRENCH: case RETRO_LANGUAGE_FRENCH:
case RETRO_LANGUAGE_SPANISH: case RETRO_LANGUAGE_SPANISH:
@ -99,20 +94,18 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
case RETRO_LANGUAGE_SWEDISH: case RETRO_LANGUAGE_SWEDISH:
case RETRO_LANGUAGE_CZECH: case RETRO_LANGUAGE_CZECH:
case RETRO_LANGUAGE_HUNGARIAN: case RETRO_LANGUAGE_HUNGARIAN:
/* These languages are not yet added #if 0
/* These languages are not yet added */
case RETRO_LANGUAGE_ROMANIAN: case RETRO_LANGUAGE_ROMANIAN:
case RETRO_LANGUAGE_CROATIAN: case RETRO_LANGUAGE_CROATIAN:
case RETRO_LANGUAGE_SERBIAN: case RETRO_LANGUAGE_SERBIAN:
case RETRO_LANGUAGE_WELSH: case RETRO_LANGUAGE_WELSH:
*/ #endif
{
font_file = FONT_6X10_FILE_LSE; font_file = FONT_6X10_FILE_LSE;
font_size = FONT_6X10_SIZE_LSE; font_size = FONT_6X10_SIZE_LSE;
glyph_min = FONT_6X10_GLYPH_MIN_LSE; glyph_min = FONT_6X10_GLYPH_MIN_LSE;
glyph_max = FONT_6X10_GLYPH_MAX_LSE; glyph_max = FONT_6X10_GLYPH_MAX_LSE;
break; break;
}
default: default:
break; break;
} }

View file

@ -15,13 +15,11 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include "../../config.def.h"
#include "../input_driver.h" #include "../input_driver.h"
#include "../input_keymaps.h" #include "../input_keymaps.h"
#include "../drivers_keyboard/keyboard_event_dos.h" #include "../drivers_keyboard/keyboard_event_dos.h"

View file

@ -1,11 +1,10 @@
#include <stdio.h> #include <stdint.h>
#include "../led_driver.h" #include "../led_driver.h"
#include "../led_defines.h" #include "../led_defines.h"
#include "../../input/input_overlay.h" #include "../../input/input_overlay.h"
#include "../../configuration.h" #include "../../configuration.h"
#include "../../retroarch.h"
typedef struct typedef struct
{ {

View file

@ -1,4 +1,4 @@
#include <stdio.h> #include <stdint.h>
#include "../led_driver.h" #include "../led_driver.h"
#include "../led_defines.h" #include "../led_defines.h"

View file

@ -1,12 +1,12 @@
#include <stdio.h> #include <stdio.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include "../led_driver.h" #include "../led_driver.h"
#include "../led_defines.h" #include "../led_defines.h"
#include "../../configuration.h" #include "../../configuration.h"
#include "../../retroarch.h"
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
/* Keys when setting in XKeyboardControl.led */ /* Keys when setting in XKeyboardControl.led */
#define XK_NUMLOCK 2 #define XK_NUMLOCK 2
@ -49,32 +49,37 @@ static keyboard_led_t *x11kb_cur = &x11kb_curins;
static int get_led(int led) static int get_led(int led)
{ {
Display *dpy = XOpenDisplay(0);
XKeyboardState state; XKeyboardState state;
Display *dpy = XOpenDisplay(0);
XGetKeyboardControl(dpy, &state); XGetKeyboardControl(dpy, &state);
XCloseDisplay(dpy); XCloseDisplay(dpy);
switch (led) switch (led)
{ {
case XK_NUMLOCK: case XK_NUMLOCK:
return (state.led_mask & XM_NUMLOCK) ? 1 : 0; if (state.led_mask & XM_NUMLOCK)
return 1;
break; break;
case XK_CAPSLOCK: case XK_CAPSLOCK:
return (state.led_mask & XM_CAPSLOCK) ? 1 : 0; if (state.led_mask & XM_CAPSLOCK)
return 1;
break; break;
case XK_SCROLLLOCK: case XK_SCROLLLOCK:
return (state.led_mask & XM_SCROLLLOCK) ? 1 : 0; if (state.led_mask & XM_SCROLLLOCK)
return 1;
break; break;
default: default:
break; break;
} }
return 0; return 0;
} }
static void set_led(int led, int state) static void set_led(int led, int state)
{ {
Display *dpy = XOpenDisplay(0);
XKeyboardControl values; XKeyboardControl values;
Display *dpy = XOpenDisplay(0);
values.led = led; values.led = led;
values.led_mode = state ? LedModeOn : LedModeOff; values.led_mode = state ? LedModeOn : LedModeOff;
XChangeKeyboardControl(dpy, KBLed | KBLedMode, &values); XChangeKeyboardControl(dpy, KBLed | KBLedMode, &values);

View file

@ -16,9 +16,9 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <boolean.h> #include <boolean.h>

View file

@ -16,9 +16,9 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <boolean.h> #include <boolean.h>

View file

@ -16,9 +16,9 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <boolean.h> #include <boolean.h>

View file

@ -15,9 +15,9 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string/stdstring.h> #include <string/stdstring.h>

View file

@ -15,9 +15,10 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string/stdstring.h> #include <string/stdstring.h>

View file

@ -15,9 +15,10 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string/stdstring.h> #include <string/stdstring.h>
@ -27,7 +28,6 @@
#include "tasks_internal.h" #include "tasks_internal.h"
#include "../configuration.h"
#include "../msg_hash.h" #include "../msg_hash.h"
#include "../file_path_special.h" #include "../file_path_special.h"
#include "../playlist.h" #include "../playlist.h"

View file

@ -15,17 +15,17 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <time.h>
#include <boolean.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
#include <stdio.h>
#include <stddef.h>
#include <time.h>
#include <boolean.h>
#include <stdint.h>
#include <string.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <string/stdstring.h> #include <string/stdstring.h>