Clenup: use STREQ macro

This commit is contained in:
2020-08-08 12:14:52 +10:00
parent 586a308467
commit 61a045b7d3
15 changed files with 33 additions and 33 deletions

View File

@@ -166,7 +166,7 @@ static bool idkey_cmp(const void *a, const void *b)
{
const struct IDNameLib_Key *idkey_a = a;
const struct IDNameLib_Key *idkey_b = b;
return strcmp(idkey_a->name, idkey_b->name) != 0 || (idkey_a->lib != idkey_b->lib);
return !STREQ(idkey_a->name, idkey_b->name) || (idkey_a->lib != idkey_b->lib);
}
ID *BKE_main_idmap_lookup_name(struct IDNameLib_Map *id_map,

View File

@@ -55,7 +55,7 @@ static bool fmap_unique_check(void *arg, const char *name)
for (fmap = data->ob->fmaps.first; fmap; fmap = fmap->next) {
if (data->fm != fmap) {
if (!strcmp(fmap->name, name)) {
if (STREQ(fmap->name, name)) {
return true;
}
}

View File

@@ -444,7 +444,7 @@ static void seq_disk_cache_delete_invalid_files(SeqDiskCache *disk_cache,
while (cache_file) {
next_file = cache_file->next;
if (cache_file->cache_type & invalidate_types) {
if (strcmp(cache_dir, cache_file->dir) == 0) {
if (STREQ(cache_dir, cache_file->dir)) {
int cfra_start = seq_cache_frame_index_to_cfra(seq, cache_file->start_frame);
if (cfra_start > range_start && cfra_start <= range_end) {
seq_disk_cache_delete_file(disk_cache, cache_file);

View File

@@ -138,7 +138,7 @@ static bool seq_prefetch_job_is_waiting(Scene *scene)
static Sequence *sequencer_prefetch_get_original_sequence(Sequence *seq, ListBase *seqbase)
{
LISTBASE_FOREACH (Sequence *, seq_orig, seqbase) {
if (strcmp(seq->name, seq_orig->name) == 0) {
if (STREQ(seq->name, seq_orig->name)) {
return seq_orig;
}

View File

@@ -950,8 +950,8 @@ static int delete_soft(const char *file, const char **error_message)
char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");
char *xdg_session_desktop = getenv("XDG_SESSION_DESKTOP");
if ((xdg_current_desktop != NULL && strcmp(xdg_current_desktop, "KDE") == 0) ||
(xdg_session_desktop != NULL && strcmp(xdg_session_desktop, "KDE") == 0)) {
if ((xdg_current_desktop != NULL && STREQ(xdg_current_desktop, "KDE")) ||
(xdg_session_desktop != NULL && STREQ(xdg_session_desktop, "KDE"))) {
args[0] = "kioclient5";
args[1] = "move";
args[2] = file;

View File

@@ -1201,7 +1201,7 @@ static void do_version_fcurve_hide_viewport_fix(struct ID *UNUSED(id),
struct FCurve *fcu,
void *UNUSED(user_data))
{
if (strcmp(fcu->rna_path, "hide") != 0) {
if (!STREQ(fcu->rna_path, "hide")) {
return;
}

View File

@@ -111,11 +111,11 @@ static GPUPass *gpu_pass_cache_resolve_collision(GPUPass *pass,
BLI_spin_lock(&pass_cache_spin);
/* Collision, need to strcmp the whole shader. */
for (; pass && (pass->hash == hash); pass = pass->next) {
if ((defs != NULL) && (strcmp(pass->defines, defs) != 0)) { /* Pass */
if ((defs != NULL) && (!STREQ(pass->defines, defs))) { /* Pass */
}
else if ((geom != NULL) && (strcmp(pass->geometrycode, geom) != 0)) { /* Pass */
else if ((geom != NULL) && (!STREQ(pass->geometrycode, geom))) { /* Pass */
}
else if ((strcmp(pass->fragmentcode, frag) == 0) && (strcmp(pass->vertexcode, vert) == 0)) {
else if ((!STREQ(pass->fragmentcode, frag) == 0) && (STREQ(pass->vertexcode, vert))) {
BLI_spin_unlock(&pass_cache_spin);
return pass;
}

View File

@@ -457,10 +457,10 @@ GPUNodeLink *GPU_volume_grid(GPUMaterial *mat, const char *name)
/* Two special cases, where we adjust the output values of smoke grids to
* bring the into standard range without having to modify the grid values. */
if (strcmp(name, "color") == 0) {
if (STREQ(name, "color")) {
GPU_link(mat, "node_attribute_volume_color", link, transform_link, &link);
}
else if (strcmp(name, "temperature") == 0) {
else if (STREQ(name, "temperature")) {
GPU_link(mat, "node_attribute_volume_temperature", link, transform_link, &link);
}
else {

View File

@@ -111,7 +111,7 @@ static const char *BuiltinUniformBlock_name(GPUUniformBlockBuiltin u)
GPU_INLINE bool match(const char *a, const char *b)
{
return strcmp(a, b) == 0;
return STREQ(a, b);
}
GPU_INLINE uint hash_string(const char *str)

View File

@@ -479,7 +479,7 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) {
if (prop->type == IDP_STRING) {
int text_len;
if (!strcmp(prop->name, "None")) {
if (STREQ(prop->name, "None")) {
jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *)IDP_String(prop), prop->len + 1);
}

View File

@@ -1169,7 +1169,7 @@ void IMB_exrtile_write_channels(
/* eventually we can make the parts' channels to include
* only the current view TODO */
if (strcmp(viewname, echan->m->view.c_str()) != 0) {
if (!STREQ(viewname, echan->m->view.c_str())) {
continue;
}

View File

@@ -330,7 +330,7 @@ static void read_custom_data_mcols(const std::string &iobject_full_name,
if (IC3fGeomParam::matches(prop_header)) {
IC3fGeomParam color_param(arbGeomParams, prop_header.getName());
IC3fGeomParam::Sample sample;
BLI_assert(!strcmp("rgb", color_param.getInterpretation()));
BLI_assert(STREQ("rgb", color_param.getInterpretation()));
color_param.getIndexed(sample, iss);
is_facevarying = sample.getScope() == kFacevaryingScope &&
@@ -343,7 +343,7 @@ static void read_custom_data_mcols(const std::string &iobject_full_name,
else if (IC4fGeomParam::matches(prop_header)) {
IC4fGeomParam color_param(arbGeomParams, prop_header.getName());
IC4fGeomParam::Sample sample;
BLI_assert(!strcmp("rgba", color_param.getInterpretation()));
BLI_assert(STREQ("rgba", color_param.getInterpretation()));
color_param.getIndexed(sample, iss);
is_facevarying = sample.getScope() == kFacevaryingScope &&

View File

@@ -385,8 +385,8 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
/* "float gravity [3]" was parsed wrong giving both "gravity" and
* "[3]" members. we rename "[3]", and later set the type of
* "gravity" to "void" so the offsets work out correct */
if (*cp == '[' && strcmp(cp, "[3]") == 0) {
if (nr && strcmp(sdna->names[nr - 1], "Cvi") == 0) {
if (*cp == '[' && STREQ(cp, "[3]")) {
if (nr && STREQ(sdna->names[nr - 1], "Cvi")) {
sdna->names[nr] = "gravity[3]";
gravity_fix = nr;
}
@@ -497,7 +497,7 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
if (gravity_fix > -1) {
for (int nr = 0; nr < sdna->structs_len; nr++) {
sp = sdna->structs[nr];
if (strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0) {
if (STREQ(sdna->types[sp[0]], "ClothSimSettings")) {
sp[10] = SDNA_TYPE_VOID;
}
}
@@ -698,13 +698,13 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
while (b > 0) {
str1 = newsdna->types[sp_new[0]];
str2 = oldsdna->types[sp_old[0]];
if (strcmp(str1, str2) != 0) {
if (!STREQ(str1, str2)) {
break;
}
str1 = newsdna->names[sp_new[1]];
str2 = oldsdna->names[sp_old[1]];
if (strcmp(str1, str2) != 0) {
if (!STREQ(str1, str2)) {
break;
}
@@ -985,7 +985,7 @@ static bool elem_exists_impl(
oname = names[old[1]];
if (elem_strcmp(name, oname) == 0) { /* name equal */
return strcmp(type, otype) == 0; /* type equal */
return STREQ(type, otype); /* type equal */
}
}
return false;
@@ -1061,7 +1061,7 @@ static const char *find_elem(const SDNA *sdna,
len = DNA_elem_size_nr(sdna, old[0], old[1]);
if (elem_strcmp(name, oname) == 0) { /* name equal */
if (strcmp(type, otype) == 0) { /* type equal */
if (STREQ(type, otype)) { /* type equal */
if (sppo) {
*sppo = old;
}
@@ -1129,7 +1129,7 @@ static void reconstruct_elem(const SDNA *newsdna,
oname = oldsdna->names[old[1]];
len = DNA_elem_size_nr(oldsdna, old[0], old[1]);
if (strcmp(name, oname) == 0) { /* name equal */
if (STREQ(name, oname)) { /* name equal */
if (ispointer(name)) { /* pointer of functionpointer afhandelen */
cast_pointer(newsdna->pointer_size,
@@ -1138,7 +1138,7 @@ static void reconstruct_elem(const SDNA *newsdna,
curdata,
olddata);
}
else if (strcmp(type, otype) == 0) { /* type equal */
else if (STREQ(type, otype)) { /* type equal */
memcpy(curdata, olddata, len);
}
else {
@@ -1158,7 +1158,7 @@ static void reconstruct_elem(const SDNA *newsdna,
cast_pointer(
newsdna->pointer_size, oldsdna->pointer_size, min_name_array_len, curdata, olddata);
}
else if (strcmp(type, otype) == 0) { /* type equal */
else if (STREQ(type, otype)) { /* type equal */
/* size of single old array element */
mul = len / old_name_array_len;
/* smaller of sizes of old and new arrays */
@@ -1166,7 +1166,7 @@ static void reconstruct_elem(const SDNA *newsdna,
memcpy(curdata, olddata, mul);
if (old_name_array_len > new_name_array_len && strcmp(type, "char") == 0) {
if (old_name_array_len > new_name_array_len && STREQ(type, "char")) {
/* string had to be truncated, ensure it's still null-terminated */
curdata[mul - 1] = '\0';
}
@@ -1365,7 +1365,7 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
/* exception: variable called blocktype: derived from ID_ */
bool skip = false;
if (name[0] == 'b' && name[1] == 'l') {
if (strcmp(name, "blocktype") == 0) {
if (STREQ(name, "blocktype")) {
skip = true;
}
}

View File

@@ -370,7 +370,7 @@ static int add_type(const char *str, int size)
/* search through type array */
for (int index = 0; index < types_len; index++) {
if (strcmp(str, types[index]) == 0) {
if (STREQ(str, types[index])) {
if (size) {
types_size_native[index] = size;
types_size_32[index] = size;
@@ -523,7 +523,7 @@ static int add_name(const char *str)
/* search name array */
for (nr = 0; nr < names_len; nr++) {
if (strcmp(name, names[nr]) == 0) {
if (STREQ(name, names[nr])) {
return nr;
}
}

View File

@@ -475,7 +475,7 @@ RenderResult *render_result_new(Render *re,
const char *view = rv->name;
if (viewname && viewname[0]) {
if (strcmp(view, viewname) != 0) {
if (!STREQ(view, viewname)) {
continue;
}
}
@@ -877,7 +877,7 @@ void render_result_merge(RenderResult *rr, RenderResult *rrpart)
continue;
}
/* Renderresult have all passes, renderpart only the active view's passes. */
if (strcmp(rpassp->fullname, rpass->fullname) != 0) {
if (!STREQ(rpassp->fullname, rpass->fullname)) {
continue;
}