diff --git a/compat/apple_compat.h b/compat/apple_compat.h
index 4117a3a1aa..15f0f297d8 100644
--- a/compat/apple_compat.h
+++ b/compat/apple_compat.h
@@ -14,7 +14,8 @@
* If not, see .
*/
-// Prefix header for all source files of the 'RetroArch' target in the 'RetroArch' project
+/* Prefix header for all source files of the 'RetroArch'
+ * target in the 'RetroArch' project. */
#ifdef IOS
#import
diff --git a/compat/compat.c b/compat/compat.c
index 0d575c0d2b..3b2dc1e25b 100644
--- a/compat/compat.c
+++ b/compat/compat.c
@@ -80,8 +80,8 @@ static int parse_short(const char *optstring, char * const *argv)
bool extra_opt = argv[0][2];
bool takes_arg = opt[1] == ':';
- // If we take an argument, and we see additional characters,
- // this is in fact the argument (i.e. -cfoo is same as -c foo).
+ /* If we take an argument, and we see additional characters,
+ * this is in fact the argument (i.e. -cfoo is same as -c foo). */
bool embedded_arg = extra_opt && takes_arg;
if (takes_arg)
@@ -99,8 +99,11 @@ static int parse_short(const char *optstring, char * const *argv)
return optarg ? opt[0] : '?';
}
- else if (embedded_arg) // If we see additional characters, and they don't take arguments, this means we have multiple flags in one.
+ else if (embedded_arg)
{
+ /* If we see additional characters,
+ * and they don't take arguments, this
+ * means we have multiple flags in one. */
memmove(&argv[0][1], &argv[0][2], strlen(&argv[0][2]) + 1);
return opt[0];
}
@@ -127,7 +130,7 @@ static int parse_long(const struct option *longopts, char * const *argv)
if (!opt)
return '?';
- // getopt_long has an "optional" arg, but we don't bother with that.
+ /* getopt_long has an "optional" arg, but we don't bother with that. */
if (opt->has_arg && !argv[1])
return '?';
@@ -144,8 +147,8 @@ static int parse_long(const struct option *longopts, char * const *argv)
*opt->flag = opt->val;
return 0;
}
- else
- return opt->val;
+
+ return opt->val;
}
static void shuffle_block(char **begin, char **last, char **end)
@@ -175,18 +178,19 @@ int getopt_long(int argc, char *argv[],
int short_index = find_short_index(&argv[optind]);
int long_index = find_long_index(&argv[optind]);
- // We're done here.
+ /* We're done here. */
if (short_index == -1 && long_index == -1)
return -1;
- // Reorder argv so that non-options come last.
- // Non-POSIXy, but that's what getopt does by default.
+ /* Reorder argv so that non-options come last.
+ * Non-POSIXy, but that's what getopt does by default. */
if ((short_index > 0) && ((short_index < long_index) || (long_index == -1)))
{
shuffle_block(&argv[optind], &argv[optind + short_index], &argv[argc]);
short_index = 0;
}
- else if ((long_index > 0) && ((long_index < short_index) || (short_index == -1)))
+ else if ((long_index > 0) && ((long_index < short_index)
+ || (short_index == -1)))
{
shuffle_block(&argv[optind], &argv[optind + long_index], &argv[argc]);
long_index = 0;
@@ -205,7 +209,7 @@ int getopt_long(int argc, char *argv[],
#endif
#ifndef HAVE_STRCASESTR
-// Pretty much strncasecmp.
+/* Pretty much strncasecmp. */
static int casencmp(const char *a, const char *b, size_t n)
{
size_t i;
@@ -239,7 +243,7 @@ char *strcasestr_rarch__(const char *haystack, const char *needle)
#ifndef HAVE_STRL
-// Implementation of strlcpy()/strlcat() based on OpenBSD.
+/* Implementation of strlcpy()/strlcat() based on OpenBSD. */
size_t strlcpy(char *dest, const char *source, size_t size)
{
diff --git a/compat/fnmatch_rarch.c b/compat/fnmatch_rarch.c
index 24f0aa4aab..c03865c5a3 100644
--- a/compat/fnmatch_rarch.c
+++ b/compat/fnmatch_rarch.c
@@ -21,8 +21,11 @@
#include "fnmatch_rarch.h"
-// Implemnentation of fnmatch(3) so it can be distributed to non *nix platforms
-// No flags are implemented ATM. We don't use them. Add flags as needed.
+/* Implemnentation of fnmatch(3) so it can be
+ * distributed to non *nix platforms.
+ *
+ * No flags are implemented ATM.
+ * We don't use them. Add flags as needed. */
int rl_fnmatch(const char *pattern, const char *string, int flags)
{
@@ -31,30 +34,32 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
int rv;
for (c = pattern; *c != '\0'; c++)
{
- // String ended before pattern
+ /* String ended before pattern */
if ((*c != '*') && (*string == '\0'))
return FNM_NOMATCH;
switch (*c)
{
- // Match any number of unknown chars
+ /* Match any number of unknown chars */
case '*':
- // Find next node in the pattern ignoring multiple
- // asterixes
+ /* Find next node in the pattern
+ * ignoring multiple asterixes
+ */
do {
c++;
if (*c == '\0')
return 0;
} while (*c == '*');
- // Match the remaining pattern ingnoring more and more
- // chars.
+ /* Match the remaining pattern
+ * ignoring more and more characters. */
do {
- // We reached the end of the string without a
- // match. There is a way to optimize this by
- // calculating the minimum chars needed to
- // match the remaining pattern but I don't
- // think it is worth the work ATM.
+ /* We reached the end of the string without a
+ * match. There is a way to optimize this by
+ * calculating the minimum chars needed to
+ * match the remaining pattern but I don't
+ * think it is worth the work ATM.
+ */
if (*string == '\0')
return FNM_NOMATCH;
@@ -63,16 +68,16 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
} while (rv != 0);
return 0;
- // Match char from list
+ /* Match char from list */
case '[':
charmatch = 0;
for (c++; *c != ']'; c++)
{
- // Bad formath
+ /* Bad format */
if (*c == '\0')
return FNM_NOMATCH;
- // Match already found
+ /* Match already found */
if (charmatch)
continue;
@@ -80,21 +85,21 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
charmatch = 1;
}
- // No match in list
+ /* No match in list */
if (!charmatch)
return FNM_NOMATCH;
string++;
break;
- // Has any char
+ /* Has any character */
case '?':
string++;
break;
- // Match following char verbatim
+ /* Match following character verbatim */
case '\\':
c++;
- // Dangling escape at end of pattern
- if (*c == '\0') // FIXME: Was c == '\0' (makes no sense). Not sure if c == NULL or *c == '\0' is intended. Assuming *c due to c++ right before.
+ /* Dangling escape at end of pattern */
+ if (*c == '\0') /* FIXME: Was c == '\0' (makes no sense). Not sure if c == NULL or *c == '\0' is intended. Assuming *c due to c++ right before. */
return FNM_NOMATCH;
default:
if (*c != *string)
@@ -103,7 +108,7 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
}
}
- // End of string and end of pattend
+ /* End of string and end of pattend */
if (*string == '\0')
return 0;
return FNM_NOMATCH;
diff --git a/compat/getopt_rarch.h b/compat/getopt_rarch.h
index 4f86fc5c75..10bf3b4a7b 100644
--- a/compat/getopt_rarch.h
+++ b/compat/getopt_rarch.h
@@ -20,14 +20,15 @@
#include "config.h"
#endif
-// Custom implementation of the GNU getopt_long for portability.
-// Not designed to be fully compatible,
-// but compatible with the features RetroArch uses.
+/* Custom implementation of the GNU getopt_long for portability.
+ * Not designed to be fully compatible, but compatible with
+ * the features RetroArch uses. */
#ifdef HAVE_GETOPT_LONG
#include
#else
-// Avoid possible naming collisions during link since we prefer to use the actual name.
+/* Avoid possible naming collisions during link since we
+ * prefer to use the actual name. */
#define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_rarch(argc, argv, optstring, longopts, longindex)
#ifdef __cplusplus
@@ -42,8 +43,9 @@ struct option
int val;
};
-// argv[] is declared with char * const argv[] in GNU,
-// but this makes no sense, as non-POSIX getopt_long mutates argv (non-opts are moved to the end).
+/* argv[] is declared with char * const argv[] in GNU,
+ * but this makes no sense, as non-POSIX getopt_long
+ * mutates argv (non-opts are moved to the end). */
int getopt_long(int argc, char *argv[],
const char *optstring, const struct option *longopts, int *longindex);
extern char *optarg;
diff --git a/compat/rxml/rxml.c b/compat/rxml/rxml.c
index e00727c734..33fef0bdc2 100644
--- a/compat/rxml/rxml.c
+++ b/compat/rxml/rxml.c
@@ -72,12 +72,11 @@ static bool validate_header(const char **ptr)
if (!eol)
return false;
- // Always use UTF-8. Don't really care to check.
+ /* Always use UTF-8. Don't really care to check. */
*ptr = eol + 3;
return true;
}
- else
- return true;
+ return true;
}
static bool range_is_space(const char *begin, const char *end)
@@ -113,7 +112,8 @@ static char *strdup_range(const char *begin, const char *end)
static char *strdup_range_escape(const char *begin, const char *end)
{
- return strdup_range(begin, end); // Escaping is ignored. Assume we don't deal with that.
+ /* Escaping is ignored. Assume we don't deal with that. */
+ return strdup_range(begin, end);
}
static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
@@ -148,7 +148,8 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
if (!attrib || !value)
goto end;
- struct rxml_attrib_node *new_node = (struct rxml_attrib_node*)calloc(1, sizeof(*new_node));
+ struct rxml_attrib_node *new_node =
+ (struct rxml_attrib_node*)calloc(1, sizeof(*new_node));
if (!new_node)
goto end;
@@ -233,9 +234,10 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
if (!rxml_parse_tag(node, str))
goto error;
- is_closing = strstr(ptr, "/>") + 1 == closing; // Are spaces between / and > allowed?
+ /* Are spaces between / and > allowed? */
+ is_closing = strstr(ptr, "/>") + 1 == closing;
- // Look for more data. Either child nodes or data.
+ /* Look for more data. Either child nodes or data. */
if (!is_closing)
{
size_t closing_tag_size = strlen(node->name) + 4;
@@ -262,8 +264,9 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
goto error;
}
- if (cdata_start && range_is_space(closing + 1, cdata_start)) // CDATA section
+ if (cdata_start && range_is_space(closing + 1, cdata_start))
{
+ /* CDATA section */
const char *cdata_end = strstr(cdata_start, "]]>");
if (!cdata_end)
{
@@ -273,10 +276,11 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
node->data = strdup_range(cdata_start + strlen("data = strdup_range(closing + 1, closing_start);
- else // Parse all child nodes.
+ else
{
+ /* Parse all child nodes. */
struct rxml_node *list = NULL;
struct rxml_node *tail = NULL;
@@ -356,7 +360,8 @@ static char *purge_xml_comments(const char *str)
copy_src = comment_end + strlen("-->");
}
- // Avoid strcpy() as OpenBSD is anal and hates you for using it even when it's perfectly safe.
+ /* Avoid strcpy() as OpenBSD is anal and hates you
+ * for using it even when it's perfectly safe. */
len = strlen(copy_src);
memcpy(copy_dest, copy_src, len);
copy_dest[len] = '\0';
diff --git a/compat/rxml/rxml.h b/compat/rxml/rxml.h
index bdb9f465b1..3a0b87eefc 100644
--- a/compat/rxml/rxml.h
+++ b/compat/rxml/rxml.h
@@ -20,14 +20,16 @@
extern "C" {
#endif
-// Total NIH. Very trivial "XML" implementation for use in RetroArch.
-// Error checking is minimal. Invalid documents may lead to very buggy behavior, but
-// memory corruption should never happen.
-//
-// Only parts of standard that RetroArch cares about is supported.
-// Nothing more, nothing less. "Clever" XML documents will probably break the implementation.
-//
-// Do *NOT* try to use this for anything else. You have been warned.
+/* Total NIH. Very trivial "XML" implementation for use in RetroArch.
+ * Error checking is minimal. Invalid documents may lead to very
+ * buggy behavior, but memory corruption should never happen.
+ *
+ * Only parts of standard that RetroArch cares about is supported.
+ * Nothing more, nothing less. "Clever" XML documents will
+ * probably break the implementation.
+ *
+ * Do *NOT* try to use this for anything else. You have been warned.
+ */
typedef struct rxml_document rxml_document_t;
@@ -47,7 +49,9 @@ struct rxml_node
struct rxml_node *children;
struct rxml_node *next;
- int type; // Dummy. Used by libxml2 compat. Is always set to 0, so XML_ELEMENT_NODE check goes through.
+ /* Dummy. Used by libxml2 compat.
+ * Is always set to 0, so XML_ELEMENT_NODE check goes through. */
+ int type;
};
rxml_document_t *rxml_load_document(const char *path);
@@ -55,14 +59,16 @@ void rxml_free_document(rxml_document_t *doc);
struct rxml_node *rxml_root_node(rxml_document_t *doc);
-// Drop const-correctness here to avoid warnings when used as libxml2 compat.
-// xmlGetProp() returns xmlChar*, which is supposed to be passed to xmlFree().
+/* Drop const-correctness here to avoid warnings
+ * when used as libxml2 compat.
+ * xmlGetProp() returns xmlChar*, which is supposed
+ * to be passed to xmlFree(). */
char *rxml_node_attrib(struct rxml_node *node, const char *attrib);
#ifdef RXML_LIBXML2_COMPAT
-// Compat for part of libxml2 that RetroArch uses.
+/* Compat for part of libxml2 that RetroArch uses. */
#define LIBXML_TEST_VERSION ((void)0)
-typedef char xmlChar; // It's really unsigned char, but it doesn't matter.
+typedef char xmlChar; /* It's really unsigned char, but it doesn't matter. */
typedef struct rxml_node *xmlNodePtr;
typedef void *xmlParserCtxtPtr;
typedef rxml_document_t *xmlDocPtr;
diff --git a/compat/rxml/rxml_test.c b/compat/rxml/rxml_test.c
index 7051b45a62..375a443249 100644
--- a/compat/rxml/rxml_test.c
+++ b/compat/rxml/rxml_test.c
@@ -22,8 +22,10 @@ static void print_siblings(struct rxml_node *node, unsigned level)
if (node->data)
fprintf(stderr, "%*sData: %s\n", level * 4, "", node->data);
- for (const struct rxml_attrib_node *attrib = node->attrib; attrib; attrib = attrib->next)
- fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "", attrib->attrib, attrib->value);
+ for (const struct rxml_attrib_node *attrib =
+ node->attrib; attrib; attrib = attrib->next)
+ fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "",
+ attrib->attrib, attrib->value);
if (node->children)
print_siblings(node->children, level + 1);
diff --git a/compat/strcasestr.h b/compat/strcasestr.h
index 0d98af48b6..40ba121939 100644
--- a/compat/strcasestr.h
+++ b/compat/strcasestr.h
@@ -28,7 +28,8 @@
extern "C" {
#endif
-// Avoid possible naming collisions during link since we prefer to use the actual name.
+/* Avoid possible naming collisions during link
+ * since we prefer to use the actual name. */
#define strcasestr(haystack, needle) strcasestr_rarch__(haystack, needle)
char *strcasestr(const char *haystack, const char *needle);
diff --git a/compat/strl.h b/compat/strl.h
index b55aa00f5e..bf9091d881 100644
--- a/compat/strl.h
+++ b/compat/strl.h
@@ -28,7 +28,8 @@
#ifdef __cplusplus
extern "C" {
#endif
-// Avoid possible naming collisions during link since we prefer to use the actual name.
+/* Avoid possible naming collisions during link since
+ * we prefer to use the actual name. */
#define strlcpy(dst, src, size) strlcpy_rarch__(dst, src, size)
#define strlcat(dst, src, size) strlcat_rarch__(dst, src, size)
diff --git a/driver.h b/driver.h
index 8a7a4e9aec..ffe8165726 100644
--- a/driver.h
+++ b/driver.h
@@ -231,17 +231,20 @@ typedef struct input_driver
{
void *(*init)(void);
void (*poll)(void *data);
- int16_t (*input_state)(void *data, const struct retro_keybind **retro_keybinds,
+ int16_t (*input_state)(void *data,
+ const struct retro_keybind **retro_keybinds,
unsigned port, unsigned device, unsigned index, unsigned id);
bool (*key_pressed)(void *data, int key);
void (*free)(void *data);
- bool (*set_sensor_state)(void *data, unsigned port, enum retro_sensor_action action, unsigned rate);
+ bool (*set_sensor_state)(void *data, unsigned port,
+ enum retro_sensor_action action, unsigned rate);
float (*get_sensor_input)(void *data, unsigned port, unsigned id);
uint64_t (*get_capabilities)(void *data);
const char *ident;
void (*grab_mouse)(void *data, bool state);
- bool (*set_rumble)(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t state);
+ bool (*set_rumble)(void *data, unsigned port,
+ enum retro_rumble_effect effect, uint16_t state);
const rarch_joypad_driver_t *(*get_joypad_driver)(void *data);
} input_driver_t;
@@ -263,7 +266,8 @@ typedef struct camera_driver
{
/* FIXME: params for initialization - queries for resolution,
* framerate, color format which might or might not be honored. */
- void *(*init)(const char *device, uint64_t buffer_types, unsigned width, unsigned height);
+ void *(*init)(const char *device, uint64_t buffer_types,
+ unsigned width, unsigned height);
void (*free)(void *data);
@@ -288,8 +292,10 @@ typedef struct location_driver
bool (*start)(void *data);
void (*stop)(void *data);
- bool (*get_position)(void *data, double *lat, double *lon, double *horiz_accuracy, double *vert_accuracy);
- void (*set_interval)(void *data, unsigned interval_msecs, unsigned interval_distance);
+ bool (*get_position)(void *data, double *lat, double *lon,
+ double *horiz_accuracy, double *vert_accuracy);
+ void (*set_interval)(void *data, unsigned interval_msecs,
+ unsigned interval_distance);
const char *ident;
} location_driver_t;
@@ -299,9 +305,12 @@ struct rarch_viewport;
typedef struct video_overlay_interface
{
void (*enable)(void *data, bool state);
- bool (*load)(void *data, const struct texture_image *images, unsigned num_images);
- void (*tex_geom)(void *data, unsigned image, float x, float y, float w, float h);
- void (*vertex_geom)(void *data, unsigned image, float x, float y, float w, float h);
+ bool (*load)(void *data,
+ const struct texture_image *images, unsigned num_images);
+ void (*tex_geom)(void *data, unsigned image,
+ float x, float y, float w, float h);
+ void (*vertex_geom)(void *data, unsigned image,
+ float x, float y, float w, float h);
void (*full_screen)(void *data, bool enable);
void (*set_alpha)(void *data, unsigned image, float mod);
} video_overlay_interface_t;
@@ -348,7 +357,8 @@ typedef struct video_poke_interface
/* Enable or disable rendering. */
void (*set_texture_enable)(void *data, bool enable, bool full_screen);
#endif
- void (*set_osd_msg)(void *data, const char *msg, const struct font_params *params);
+ void (*set_osd_msg)(void *data, const char *msg,
+ const struct font_params *params);
void (*show_mouse)(void *data, bool state);
void (*grab_mouse_toggle)(void *data);
diff --git a/dynamic.c b/dynamic.c
index 287690b73a..c80f8c7a69 100644
--- a/dynamic.c
+++ b/dynamic.c
@@ -123,7 +123,7 @@ void libretro_get_environment_info(void (*func)(retro_environment_t),
{
load_no_content_hook = load_no_content;
- // load_no_content gets set in this callback.
+ /* load_no_content gets set in this callback. */
func(environ_cb_get_system_info);
}
diff --git a/tests/test_reentrancy.c b/tests/test_reentrancy.c
index d00d6da4b7..26f4f184bd 100644
--- a/tests/test_reentrancy.c
+++ b/tests/test_reentrancy.c
@@ -13,9 +13,10 @@
* If not, see .
*/
-// Test module to check re-entrancy of libretro implementations.
-// Reruns RetroArch main loop with all content defined on command-line
-// to check if libretro can load multiple content after each other.
+/* Test module to check re-entrancy of libretro implementations.
+ * Reruns RetroArch main loop with all content defined on command-line
+ * to check if libretro can load multiple content after each other.
+ */
#include "../getopt_rarch.h"
#include "../general.h"
@@ -31,7 +32,8 @@ int main(int argc, char *argv[])
if (optind + 1 >= argc)
return 0;
- memmove(&argv[optind], &argv[optind + 1], (argc - optind - 1) * sizeof(char*));
+ memmove(&argv[optind], &argv[optind + 1],
+ (argc - optind - 1) * sizeof(char*));
argc--;
rarch_main_clear_state();