mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 05:13:59 +02:00
- updated code to protect against null pointers and uninitialized values and threading issues
This commit is contained in:
@@ -218,12 +218,14 @@ namespace Shared { namespace Util {
|
||||
|
||||
|
||||
void strrev(char *p) {
|
||||
char *q = p;
|
||||
while(q && *q) ++q;
|
||||
for(--q; p < q; ++p, --q)
|
||||
*p = *p ^ *q,
|
||||
*q = *p ^ *q,
|
||||
*p = *p ^ *q;
|
||||
if(p != NULL) {
|
||||
char *q = p;
|
||||
while(q && *q) ++q;
|
||||
for(--q; p < q; ++p, --q)
|
||||
*p = *p ^ *q,
|
||||
*q = *p ^ *q,
|
||||
*p = *p ^ *q;
|
||||
}
|
||||
}
|
||||
|
||||
#define SWP(x,y) (x^=y, y^=x, x^=y)
|
||||
|
Reference in New Issue
Block a user