mirror of https://github.com/mgba-emu/mgba.git
Util: Add rtrim
This commit is contained in:
parent
947ef7edea
commit
0367d94aad
1
CHANGES
1
CHANGES
|
@ -62,6 +62,7 @@ Misc:
|
||||||
- Qt: Remove default autofire mappings
|
- Qt: Remove default autofire mappings
|
||||||
- PSP2: Allow UTF-8 filenames
|
- PSP2: Allow UTF-8 filenames
|
||||||
- Util: Add Vector GetConstPointer
|
- Util: Add Vector GetConstPointer
|
||||||
|
- Util: Add rtrim
|
||||||
|
|
||||||
0.4.1: (2016-07-11)
|
0.4.1: (2016-07-11)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -340,3 +340,14 @@ const char* hex4(const char* line, uint8_t* out) {
|
||||||
*out = value;
|
*out = value;
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rtrim(char* string) {
|
||||||
|
if (!*string) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
char* end = string + strlen(string) - 1;
|
||||||
|
while (isspace((int) *end) && end >= string) {
|
||||||
|
*end = '\0';
|
||||||
|
--end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,4 +33,6 @@ const char* hex12(const char* line, uint16_t* out);
|
||||||
const char* hex8(const char* line, uint8_t* out);
|
const char* hex8(const char* line, uint8_t* out);
|
||||||
const char* hex4(const char* line, uint8_t* out);
|
const char* hex4(const char* line, uint8_t* out);
|
||||||
|
|
||||||
|
void rtrim(char* string);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue