halt="don't use ctype macros (use c-ctype.h)" \
$(_sc_search_regexp)
+sc_avoid_strcase:
+ @prohibit='\bstrn?case(cmp|str) *\(' \
+ halt="don't use raw strcase functions (use c-strcase instead)" \
+ $(_sc_search_regexp)
+
sc_prohibit_virBufferAdd_with_string_literal:
@prohibit='\<virBufferAdd *\([^,]+, *"[^"]' \
halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
syntax-check: $(top_srcdir)/HACKING
# List all syntax-check exemptions:
+exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.c$$
+
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(command|util)|xen/xend_internal
exclude_file_name_regexp--sc_avoid_write = \
^(src/($(_src1))|daemon/libvirtd|tools/console)\.c$$
# include "libvirt_internal.h"
+# include "c-strcase.h"
+
/* On architectures which lack these limits, define them (ie. Cygwin).
* Note that the libvirt code should be robust enough to handle the
* case where actual value is longer than these limits (eg. by setting
/* String equality tests, suggested by Jim Meyering. */
# define STREQ(a,b) (strcmp(a,b) == 0)
-# define STRCASEEQ(a,b) (strcasecmp(a,b) == 0)
+# define STRCASEEQ(a,b) (c_strcasecmp(a,b) == 0)
# define STRNEQ(a,b) (strcmp(a,b) != 0)
-# define STRCASENEQ(a,b) (strcasecmp(a,b) != 0)
+# define STRCASENEQ(a,b) (c_strcasecmp(a,b) != 0)
# define STREQLEN(a,b,n) (strncmp(a,b,n) == 0)
-# define STRCASEEQLEN(a,b,n) (strncasecmp(a,b,n) == 0)
+# define STRCASEEQLEN(a,b,n) (c_strncasecmp(a,b,n) == 0)
# define STRNEQLEN(a,b,n) (strncmp(a,b,n) != 0)
-# define STRCASENEQLEN(a,b,n) (strncasecmp(a,b,n) != 0)
+# define STRCASENEQLEN(a,b,n) (c_strncasecmp(a,b,n) != 0)
# define STRPREFIX(a,b) (strncmp(a,b,strlen(b)) == 0)
# define STRSKIP(a,b) (STRPREFIX(a,b) ? (a) + strlen(b) : NULL)
#include "qemu_monitor_text.h"
#include "qemu_command.h"
#include "c-ctype.h"
+#include "c-strcasestr.h"
#include "memory.h"
#include "logging.h"
#include "driver.h"
/* If the command failed qemu prints:
* device not found, device is locked ...
* No message is printed on success it seems */
- if (strcasestr(reply, "device ")) {
+ if (c_strcasestr(reply, "device ")) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("could not eject media on %s: %s"), devname, reply);
goto cleanup;