parser: Assign value without if-statement
This avoids an if
-statement, because effectively it does nothing.
And, for example, binary artifact generated by GCC with -O2 optimization settings does not contain that if-statement -- the code just uses the hprefix->name
field explicitly.
Just for fun: a disassembler snippet
The following shows that file libxml2_la-parser.o built before this patch does not contain the if
-statement.
The file was built by GCC with optimization settings set to -O2.
0000000000006c80 <xmlParseStartTag2.constprop.0>:
6c80: 41 57 push %r15
...
# xmlParseAttribute2() was inlined into xmlParseStartTag2()
6fe8: 48 8d b4 24 b0 00 00 lea 0xb0(%rsp),%rsi # hprefix
6fef: 00
6ff0: 4c 89 ff mov %r15,%rdi # ctxt (r15 was assigned above to rbx, which was assigned to ctxt)
6ff3: e8 b8 f5 ff ff call 65b0 <xmlParseQNameHashed>
...
6ffb: 48 89 d5 mov %rdx,%rbp # rbp gets hname.name
6ffe: 48 85 d2 test %rdx,%rdx
7001: 0f 84 59 04 00 00 je 7460 <xmlParseStartTag2.constprop.0+0x7e0>
7007: 49 8b bf 28 02 00 00 mov 0x228(%r15),%rdi # rdi = ctxt->attsSpecial
700e: 48 8b 9c 24 b8 00 00 mov 0xb8(%rsp),%rbx # rbx gets "hprefix + 8 bytes"; this is hprefix->name
7015: 00 # rbx is to be used below as-is, no cmp here or there
7016: 45 31 f6 xor %r14d,%r14d
7019: 48 85 ff test %rdi,%rdi
701c: 74 1e je 703c <xmlParseStartTag2.constprop.0+0x3bc>
701e: 49 89 d0 mov %rdx,%r8 # hname.name (the 5th argument for xmlHashQLookup2(); 'name' local variable is also not used here as a dedicated object)
7021: 48 8b 74 24 28 mov 0x28(%rsp),%rsi
7026: 48 8b 54 24 20 mov 0x20(%rsp),%rdx
702b: 48 89 d9 mov %rbx,%rcx # the 4th argument for xmlHashQLookup2() gets value of hprefix.name field w/o an intermediate local variable 'prefix'.
702e: 45 31 f6 xor %r14d,%r14d
7031: e8 00 00 00 00 call 7036 <xmlParseStartTag2.constprop.0+0x3b6> # call xmlHashQLookup2()
7036: 85 c0 test %eax,%eax
...
The binary code of the xmlParseStartTag2()
function is not changed by the only patch from this request.
No functional changes intended.