[Scummvm-git-logs] scummvm master -> 5814df1022184e1eb830bbc80f7248005deaf4d4
digitall
547637+digitall at users.noreply.github.com
Tue Mar 23 06:34:24 UTC 2021
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:
5814df1022 GLK: TADS: Fix Memset on Non-Trivial Structure GCC Compiler Warnings
Commit: 5814df1022184e1eb830bbc80f7248005deaf4d4
https://github.com/scummvm/scummvm/commit/5814df1022184e1eb830bbc80f7248005deaf4d4
Author: D G Turner (digitall at scummvm.org)
Date: 2021-03-23T06:33:51Z
Commit Message:
GLK: TADS: Fix Memset on Non-Trivial Structure GCC Compiler Warnings
Changed paths:
engines/glk/tads/tads2/regex.cpp
engines/glk/tads/tads2/regex.h
diff --git a/engines/glk/tads/tads2/regex.cpp b/engines/glk/tads/tads2/regex.cpp
index f83de7cefb..9b55b93fb0 100644
--- a/engines/glk/tads/tads2/regex.cpp
+++ b/engines/glk/tads/tads2/regex.cpp
@@ -1541,7 +1541,9 @@ int re_compile_and_search(re_context *ctx,
re_save_search_str(ctx, searchstr, searchlen);
/* clear the group registers */
- memset(ctx->regs, 0, sizeof(ctx->regs));
+ for (uint i = 0; i < ARRAYSIZE(ctx->regs); i++) {
+ ctx->regs[i].clear();
+ }
/*
* search for the pattern in our copy of the string - use the copy
@@ -1573,7 +1575,9 @@ int re_compile_and_match(re_context *ctx,
re_save_search_str(ctx, searchstr, searchlen);
/* clear the group registers */
- memset(ctx->regs, 0, sizeof(ctx->regs));
+ for (uint i = 0; i < ARRAYSIZE(ctx->regs); i++) {
+ ctx->regs[i].clear();
+ }
/* match the string */
return re_match(ctx, ctx->strbuf, ctx->strbuf, ctx->curlen,
diff --git a/engines/glk/tads/tads2/regex.h b/engines/glk/tads/tads2/regex.h
index 0f3acfc18b..71ed99cd22 100644
--- a/engines/glk/tads/tads2/regex.h
+++ b/engines/glk/tads/tads2/regex.h
@@ -52,6 +52,11 @@ typedef struct _re_group_register
const char *end_ofs;
_re_group_register() : start_ofs(nullptr), end_ofs(nullptr) {}
+
+ void clear() {
+ start_ofs = nullptr;
+ end_ofs = nullptr;
+ }
} re_group_register;
/* number of group registers we keep */
More information about the Scummvm-git-logs
mailing list