Skip to content

Commit 2b4f9ca

Browse files
Anton SalikhmetovChristoph Hellwig
authored andcommitted
hfsplus: assignments inside `if' condition clean-up
Make assignments outside `if' conditions for unicode.c module where the checkpatch.pl script reported this coding style error. Signed-off-by: Anton Salikhmetov <alexo@tuxera.com> Signed-off-by: Christoph Hellwig <hch@tuxera.com>
1 parent 032016a commit 2b4f9ca

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

‎fs/hfsplus/unicode.c‎

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ int hfsplus_uni2asc(struct super_block *sb,
142142
/* search for single decomposed char */
143143
if (likely(compose))
144144
ce1 = hfsplus_compose_lookup(hfsplus_compose_table, c0);
145-
if (ce1 && (cc = ce1[0])) {
145+
if (ce1)
146+
cc = ce1[0];
147+
else
148+
cc = 0;
149+
if (cc) {
146150
/* start of a possibly decomposed Hangul char */
147151
if (cc != 0xffff)
148152
goto done;
@@ -209,7 +213,8 @@ int hfsplus_uni2asc(struct super_block *sb,
209213
i++;
210214
ce2 = ce1;
211215
}
212-
if ((cc = ce2[0])) {
216+
cc = ce2[0];
217+
if (cc) {
213218
ip += i;
214219
ustrlen -= i;
215220
goto done;
@@ -301,7 +306,11 @@ int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr,
301306
while (outlen < HFSPLUS_MAX_STRLEN && len > 0) {
302307
size = asc2unichar(sb, astr, len, &c);
303308

304-
if (decompose && (dstr = decompose_unichar(c, &dsize))) {
309+
if (decompose)
310+
dstr = decompose_unichar(c, &dsize);
311+
else
312+
dstr = NULL;
313+
if (dstr) {
305314
if (outlen + dsize > HFSPLUS_MAX_STRLEN)
306315
break;
307316
do {
@@ -346,15 +355,23 @@ int hfsplus_hash_dentry(const struct dentry *dentry, const struct inode *inode,
346355
astr += size;
347356
len -= size;
348357

349-
if (decompose && (dstr = decompose_unichar(c, &dsize))) {
358+
if (decompose)
359+
dstr = decompose_unichar(c, &dsize);
360+
else
361+
dstr = NULL;
362+
if (dstr) {
350363
do {
351364
c2 = *dstr++;
352-
if (!casefold || (c2 = case_fold(c2)))
365+
if (casefold)
366+
c2 = case_fold(c2);
367+
if (!casefold || c2)
353368
hash = partial_name_hash(c2, hash);
354369
} while (--dsize > 0);
355370
} else {
356371
c2 = c;
357-
if (!casefold || (c2 = case_fold(c2)))
372+
if (casefold)
373+
c2 = case_fold(c2);
374+
if (!casefold || c2)
358375
hash = partial_name_hash(c2, hash);
359376
}
360377
}
@@ -422,12 +439,14 @@ int hfsplus_compare_dentry(const struct dentry *parent,
422439
c1 = *dstr1;
423440
c2 = *dstr2;
424441
if (casefold) {
425-
if (!(c1 = case_fold(c1))) {
442+
c1 = case_fold(c1);
443+
if (!c1) {
426444
dstr1++;
427445
dsize1--;
428446
continue;
429447
}
430-
if (!(c2 = case_fold(c2))) {
448+
c2 = case_fold(c2);
449+
if (!c2) {
431450
dstr2++;
432451
dsize2--;
433452
continue;

0 commit comments

Comments
 (0)