From: Claudio Fontana <claudio.font...@huawei.com> Hello,
I went ahead and tried to build the general solution for replacing memmem on systems which don't provide one (notably Windows), detecting the presence of memmem in configure and setting CONFIG_MEMMEM, and providing an implementation (from gnulib) for the !CONFIG_MEMMEM case. The code imported is GPLv2 in the "or later" form, which I have seen used in the util library already. I have tested this in both CONFIG_MEMMEM defined/undefined scenarios, but more feedback and testing is welcome of course. changes from v4: made into a series of two patches. Introduced a memmem replacement function (import from gnulib) and detection code in configure. changes from v3: initialize pointer variable to NULL to finally get rid of spurious warning changes from v2: move code to try to address spurious warning changes from v1: make checkpatch happy by adding braces here and there. Claudio Fontana (2): util: add memmem replacement function monitor: add memory search commands s, sp configure | 15 ++ hmp-commands.hx | 28 ++++ include/qemu/osdep.h | 4 + monitor.c | 140 ++++++++++++++++ util/Makefile.objs | 1 + util/memmem.c | 73 +++++++++ util/str-two-way.h | 452 +++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 713 insertions(+) create mode 100644 util/memmem.c create mode 100644 util/str-two-way.h -- 1.8.5.3