[Scummvm-git-logs] scummvm branch-2-6 -> 693580156d4ae37928da7c2e88ad1572cc2c3cd2

sev- noreply at scummvm.org
Sun Jun 12 11:32:31 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
693580156d DINGUX: Only evaluate the toupper() macro argument once


Commit: 693580156d4ae37928da7c2e88ad1572cc2c3cd2
    https://github.com/scummvm/scummvm/commit/693580156d4ae37928da7c2e88ad1572cc2c3cd2
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-06-12T13:32:20+02:00

Commit Message:
DINGUX: Only evaluate the toupper() macro argument once

toupper() callers should avoid putting a side-effect expression there, but
in practice it sometimes happen, so making the macro safer can't hurt.

This uses a GCC statement expression, but this port only uses GCC
anyway.

Changed paths:
    common/scummsys.h


diff --git a/common/scummsys.h b/common/scummsys.h
index f23634a209f..78dcf122e98 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -309,7 +309,7 @@
 	// Very BAD hack following, used to avoid triggering an assert in uClibc dingux library
 	// "toupper" when pressing keyboard function keys.
 	#undef toupper
-	#define toupper(c) (((c & 0xFF) >= 97) && ((c & 0xFF) <= 122) ? ((c & 0xFF) - 32) : (c & 0xFF))
+	#define toupper(c) __extension__ ({ auto _x = ((c) & 0xFF); (_x >= 97 && _x <= 122) ? (_x - 32) : _x; })
 
 #elif defined(__PSP__)
 




More information about the Scummvm-git-logs mailing list