aboutsummaryrefslogtreecommitdiff
path: root/libgm2/libm2iso/wrapsock.c
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2023-03-14 19:52:11 +0000
committerGaius Mulley <gaiusmod2@gmail.com>2023-03-14 19:52:11 +0000
commit19c5dfc29d83101e415590e778b99e7c37d9b730 (patch)
tree44a9e4b644d621b5083c029387285185ee5b5eba /libgm2/libm2iso/wrapsock.c
parent71b33f8fb8daa6a7a359f322b24365d9016438fc (diff)
downloadgcc-19c5dfc29d83101e415590e778b99e7c37d9b730.zip
gcc-19c5dfc29d83101e415590e778b99e7c37d9b730.tar.gz
gcc-19c5dfc29d83101e415590e778b99e7c37d9b730.tar.bz2
PR 109125 Modula2 SIGBUS in m2pim_ldtoa_ldtoa
13 regression failures seen on sparc SIGBUS in m2pim_ldtoa_ldtoa. This patch fixes int bool parameter mismatches between the definition modules and their C/C++ implementations. gcc/m2/ChangeLog: PR modula2/109125 * gm2-libs-ch/cgetopt.c (cgetopt_SetOption): Replace int for bool. * gm2-libs-ch/termios.c (doSetUnset): Replace int for bool. * gm2-libs/Builtins.mod (isfinitef): Correct typo in return statement. libgm2/ChangeLog: PR modula2/109125 * libm2iso/ErrnoCategory.cc (FALSE): Remove. (TRUE): Remove. * libm2iso/wrapsock.c (TRUE): Remove. (FALSE): Remove. * libm2iso/wraptime.cc (TRUE): Remove. (FALSE): Remove. * libm2pim/cgetopt.cc: Replace int for bool for every BOOLEAN parameter in the definition module. * libm2pim/dtoa.cc: Ditto. * libm2pim/ldtoa.cc: Ditto. * libm2pim/termios.cc: Ditto. (doSetUnset): Replace int for bool. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'libgm2/libm2iso/wrapsock.c')
-rw-r--r--libgm2/libm2iso/wrapsock.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/libgm2/libm2iso/wrapsock.c b/libgm2/libm2iso/wrapsock.c
index 1582f24..805271e 100644
--- a/libgm2/libm2iso/wrapsock.c
+++ b/libgm2/libm2iso/wrapsock.c
@@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "config.h"
+#include <stdbool.h>
#define EXPORT(FUNC) m2iso ## _wrapsock_ ## FUNC
#define IMPORT(MODULE,FUNC) m2iso ## _ ## MODULE ## _ ## FUNC
@@ -88,13 +89,6 @@ extern void m2iso_M2RTS_RegisterModule (const char *modulename, const char *libn
#include "stdlib.h"
#endif
-#if !defined(TRUE)
-#define TRUE (1 == 1)
-#endif
-#if !defined(FALSE)
-#define FALSE (1 == 0)
-#endif
-
#include "ChanConsts.h"
#define MAXHOSTNAME 1024
@@ -213,32 +207,32 @@ EXPORT(getClientIP) (clientInfo *c)
return c->sa.sin_addr.s_addr;
}
-/* getPushBackChar - returns TRUE if a pushed back character is
+/* getPushBackChar returns true if a pushed back character is
available. */
-unsigned int
+bool
EXPORT(getPushBackChar) (clientInfo *c, char *ch)
{
if (c->hasChar > 0)
{
c->hasChar--;
*ch = c->pbChar[c->hasChar];
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-/* setPushBackChar - returns TRUE if it is able to push back a
+/* setPushBackChar returns true if it is able to push back a
character. */
-unsigned int
+bool
EXPORT(setPushBackChar) (clientInfo *c, char ch)
{
if (c->hasChar == MAXPBBUF)
- return FALSE;
+ return false;
c->pbChar[c->hasChar] = ch;
c->hasChar++;
- return TRUE;
+ return true;
}
/* getSizeOfClientInfo - returns the sizeof (opaque data type). */