Cleanup: replace STREQLEN with STRPREFIX for constant strings

This commit is contained in:
Campbell Barton 2020-11-06 15:56:03 +11:00
parent 2d803d3f6d
commit f38ad4c66b
7 changed files with 11 additions and 11 deletions

View File

@ -1029,10 +1029,10 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
* need this to make further step with copying non-cv related curves copying
* not touching cv's f-curves */
LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, orig_curves) {
if (STREQLEN(fcu->rna_path, "splines", 7)) {
if (STRPREFIX(fcu->rna_path, "splines")) {
const char *ch = strchr(fcu->rna_path, '.');
if (ch && (STREQLEN(ch, ".bezier_points", 14) || STREQLEN(ch, ".points", 7))) {
if (ch && (STRPREFIX(ch, ".bezier_points") || STRPREFIX(ch, ".points"))) {
fcurve_remove(adt, orig_curves, fcu);
}
}
@ -1060,7 +1060,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
/* the remainders in orig_curves can be copied back (like follow path) */
/* (if it's not path to spline) */
LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, orig_curves) {
if (STREQLEN(fcu->rna_path, "splines", 7)) {
if (STRPREFIX(fcu->rna_path, "splines")) {
fcurve_remove(adt, orig_curves, fcu);
}
else {

View File

@ -463,7 +463,7 @@ void ui_block_bounds_calc(uiBlock *block)
/* hardcoded exception... but that one is annoying with larger safety */
uiBut *bt = block->buttons.first;
int xof = (bt && STREQLEN(bt->str, "ERROR", 5)) ? 10 : 40;
int xof = (bt && STRPREFIX(bt->str, "ERROR")) ? 10 : 40;
block->safety.xmin = block->rect.xmin - xof;
block->safety.ymin = block->rect.ymin - xof;

View File

@ -579,10 +579,10 @@ void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filename)
name[0] = '\0';
while (fgets(line, sizeof(line), fp) != NULL) { /* read a line */
if (STREQLEN(line, "[Bookmarks]", 11)) {
if (STRPREFIX(line, "[Bookmarks]")) {
category = FS_CATEGORY_BOOKMARKS;
}
else if (STREQLEN(line, "[Recent]", 8)) {
else if (STRPREFIX(line, "[Recent]")) {
category = FS_CATEGORY_RECENT;
}
else if (line[0] == '!') {

View File

@ -246,7 +246,7 @@ static boolean handle_app1(j_decompress_ptr cinfo)
INPUT_BYTE(cinfo, neogeo[i], return false);
}
length = 0;
if (STREQLEN(neogeo, "NeoGeo", 6)) {
if (STRPREFIX(neogeo, "NeoGeo")) {
struct NeoGeo_Word *neogeo_word = (struct NeoGeo_Word *)(neogeo + 6);
ibuf_quality = neogeo_word->quality;
}
@ -362,7 +362,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
* That is why we need split it to the
* common key/value here.
*/
if (!STREQLEN(str, "Blender", 7)) {
if (!STRPREFIX(str, "Blender")) {
/*
* Maybe the file have text that
* we don't know "what it's", in that

View File

@ -1210,7 +1210,7 @@ void IMB_exr_read_channels(void *handle)
"BlenderMultiChannel");
/* 'previous multilayer attribute, flipped. */
short flip = (ta && STREQLEN(ta->value().c_str(), "Blender V2.43", 13));
short flip = (ta && STRPREFIX(ta->value().c_str(), "Blender V2.43"));
exr_printf(
"\nIMB_exr_read_channels\n%s %-6s %-22s "

View File

@ -521,7 +521,7 @@ static void imb_png_warning(png_structp UNUSED(png_ptr), png_const_charp message
* and with new libpng it became too much picky, giving a warning on
* the splash screen even.
*/
if ((G.debug & G_DEBUG) == 0 && STREQLEN(message, "iCCP", 4)) {
if ((G.debug & G_DEBUG) == 0 && STRPREFIX(message, "iCCP")) {
return;
}
fprintf(stderr, "libpng warning: %s\n", message);

View File

@ -349,7 +349,7 @@ int main(int argc,
#if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE) && !defined(WITH_HEADLESS)
/* Patch to ignore argument finder gives us (PID?) */
if (argc == 2 && STREQLEN(argv[1], "-psn_", 5)) {
if (argc == 2 && STRPREFIX(argv[1], "-psn_")) {
extern int GHOST_HACK_getFirstFile(char buf[]);
static char firstfilebuf[512];