From 4fc84b8f15e6ac308614799a7a7b06bb55c23385 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 29 Dec 2012 16:04:45 +0000 Subject: text editor: replace strncmp() and hard coded size with STR_LITERAL_STARTSWITH() macro that gets the size from sizeof(). --- source/blender/editors/space_text/text_format.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/editors/space_text/text_format.h') diff --git a/source/blender/editors/space_text/text_format.h b/source/blender/editors/space_text/text_format.h index 02c5f433b57..0e6c0937579 100644 --- a/source/blender/editors/space_text/text_format.h +++ b/source/blender/editors/space_text/text_format.h @@ -76,4 +76,7 @@ void ED_text_format_register(TextFormatType *tft); /* formatters */ void ED_text_format_register_py(void); +#define STR_LITERAL_STARTSWITH(str, str_literal, len_var) \ + (strncmp(str, str_literal, len_var = (sizeof(str_literal) - 1)) == 0) + #endif /* __TEXT_FORMAT_H__ */ -- cgit v1.2.3