> > mingw does not provide memmem. Since the qmp data we get should not have > embedded nul characters, we can use g_strstr_len instead of memmem. See https://stackoverflow.com/questions/43969649/null-character-within-json, you can remove the should. > Should that be a problem, gnulib provides a lgplv2+ implementation of > memmem we could fallback on. > > https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=modules/memmem;h=63bd3efce10abff6ab4421650eb9df1c6bdfb2c7;hb=HEAD > Also you can remove this. > Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > --- > src/qmp-port.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/qmp-port.c b/src/qmp-port.c > index c91f967a..90527135 100644 > --- a/src/qmp-port.c > +++ b/src/qmp-port.c > @@ -160,7 +160,7 @@ spice_qmp_handle_port_data(SpiceQmpPort *self, gpointer > data, > } > > str = qmp->str; > - while ((crlf = memmem(str, qmp->len - (str - qmp->str), "\r\n", 2))) { > + while ((crlf = g_strstr_len(str, qmp->len - (str - qmp->str), "\r\n"))) > { At this point I as NUL are not allowed I would use strstr/g_strstr using normal C string functions (that require NUL terminator). So: while ((crlf = strstr(str, "\r\n"))) is enough. To be style coherent is while ((crlf = strstr(str, "\r\n")) != NULL) > GError *err = NULL; > > *crlf = '\0'; Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel