Skip to contentSkip to conversation

multipath-tools: fix an assignment ambiguity

PATCH In review Xose Vazquez Perez 2 participants 2 messages Jan 22, 2024 – Jan 23, 2024 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath-tools: fix an assignment ambiguity

spotted by indent:
./kpartx/gpt.c:623: Warning:old style assignment ambiguity in "=-". Assuming "= -"

Cc Martin Wilck <[email protected]>
Cc Benjamin Marzinski <[email protected]>
Cc Christophe Varoqui <[email protected]>
Cc DM-DEVEL ML <[email protected]>
---
 kpartx/gpt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kpartx/gpt.c +1 -1
index 47d8743e..fbf6ae22 100644
@@ -606,7 +606,7 @@ read_gpt_pt (int fd, __attribute__((unused)) struct slice all,
 	gpt_entry *ptes = NULL;
 	unsigned int i;
 	int n = 0;
-	int last_used_index=-1;
+	int last_used_index = -1;
 	int sector_size_mul = get_sector_size(fd)/512;
 
 	if (!find_valid_gpt (fd, &gpt, &ptes) || !gpt || !ptes) {
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Xose Vazquez Perez

spotted by indent:
./kpartx/gpt.c:623: Warning:old style assignment ambiguity in "=-". Assuming "= -"

Quoted 8 lines
Cc Martin Wilck <[email protected]>
Cc Benjamin Marzinski <[email protected]>
Cc Christophe Varoqui <[email protected]>
Cc DM-DEVEL ML <[email protected]>

---
 kpartx/gpt.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

This "ambiguity" must relate to some ancient compilers accepting '=-' as an alias for '-='. That must predate K&R 1st edition (1978), which clearly defines the assignment operator syntax for operator 'op' as 'op=' [1].

But well, it's always good to eliminate warnings, so

[1] https://www.academia.edu/34487452/First_edition_of_c_by_dennis_ritche