Skip to contentSkip to conversation

vvfat: fix coding style nit

PATCH In review Michael S. Tsirkin 3 participants 15 messages Sep 30, 2009 1 message not in the archive Block layer

lore
Share & tools
lore
#1 lore raw

PATCH 1/13 vvfat: fix coding style nit

In reply to a message not in the archive

Put space between = and & when taking a pointer,
to avoid confusion with old-style "&=".

---
 block/vvfat.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
block/vvfat.c +2 -2
index 1e37b9f..063f731 100644
@@ -379,7 +379,7 @@ static void init_mbr(BDRVVVFATState* s)
 {
     /* TODO: if the files mbr.img and bootsect.img exist, use them */
     mbr_t* real_mbr=(mbr_t*)s->first_sectors;
-    partition_t* partition=&(real_mbr->partition[0]);
+    partition_t* partition = &(real_mbr->partition[0]);
     int lba;
 
     memset(s->first_sectors,0,512);
@@ -526,7 +526,7 @@ static uint16_t fat_datetime(time_t time,int return_time) {
     t=localtime(&time); /* this is not thread safe */
 #else
     struct tm t1;
-    t=&t1;
+    t = &t1;
     localtime_r(&time,t);
 #endif
     if(return_time)
Signature · 1 line
1.6.5.rc2
#2 lore raw

PATCH 2/13 elfload: fix coding style nit

In reply to a message not in the archive

Put space between = and * when dereferencing a pointer, to avoid confusion with old-style "*="

---
 bsd-user/elfload.c   |    2 +-
 linux-user/elfload.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
bsd-user/elfload.c +1 -1
index 19981f0..33ddcc4 100644
@@ -1268,7 +1268,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
             }
             if (retval >= 0) {
                 interp_ex = *((struct exec *) bprm->buf); /* aout exec-header */
-                interp_elf_ex=*((struct elfhdr *) bprm->buf); /* elf exec-header */
+                interp_elf_ex = *((struct elfhdr *) bprm->buf); /* elf exec-header */
             }
             if (retval < 0) {
                 perror("load_elf_binary3");
linux-user/elfload.c +1 -1
index 7c8e771..07277a6 100644
@@ -1476,7 +1476,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
 	    }
 	    if (retval >= 0) {
 		interp_ex = *((struct exec *) bprm->buf); /* aout exec-header */
-		interp_elf_ex=*((struct elfhdr *) bprm->buf); /* elf exec-header */
+		interp_elf_ex = *((struct elfhdr *) bprm->buf); /* elf exec-header */
 	    }
 	    if (retval < 0) {
 		perror("load_elf_binary3");
Signature · 1 line
1.6.5.rc2
#3 lore raw

PATCH 3/13 gdbstub: fix coding style nit

In reply to a message not in the archive

Put space between = and * when dereferencing a pointer, to avoid confusion with old-style "*="

---
 gdbstub.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gdbstub.c +1 -1
index 33d79eb..3c31fad 100644
@@ -1284,7 +1284,7 @@ static int cpu_gdb_read_register(CPUState *env, uint8_t *mem_buf, int n)
     else if (n<63) {
        uint64_t val;
 
-       val=*((uint64_t *)&env->fir[n-32]);
+       val = *((uint64_t *)&env->fir[n-32]);
        GET_REGL(val);
     }
     else if (n==63) {
Signature · 1 line
1.6.5.rc2
#4 lore raw

PATCH 4/13 escc: fix coding style nit

In reply to a message not in the archive

Put space between = and - assigning a negative number to avoid confusion with old-style "-="
(which we also have, and needs to be fixed).

---
 hw/escc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/escc.c +2 -2
index 17694ed..cb34d7d 100644
@@ -869,9 +869,9 @@ static void sunmouse_event(void *opaque,
     ch = dx;
 
     if (ch > 127)
-        ch=127;
+        ch = 127;
     else if (ch < -127)
-        ch=-127;
+        ch = -127;
 
     put_queue(s, ch & 0xff);
 
Signature · 1 line
1.6.5.rc2
#5 lore raw

PATCH 5/13 omap_dma: fix unbalanced { in commented out code

In reply to a message not in the archive

Fix unbalanced {} in commented out code.

---
 hw/omap_dma.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
hw/omap_dma.c +3 -1
index 6f5eaca..205d010 100644
@@ -588,7 +588,7 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
 #ifdef MULTI_REQ
     /* TODO: should all of this only be done if dma->update, and otherwise
      * inside omap_dma_transfer_generic below - check what's faster.  */
-    if (dma->update) {
+    if (dma->update)
 #endif
 
     /* If the channel is element synchronized, deactivate it */
@@ -668,7 +668,9 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
 
         /* TODO: if the destination port is IMIF or EMIFF, set the dirty
          * bits on it.  */
+#ifndef MULTI_REQ
     }
+#endif
 
     omap_dma_interrupts_update(s);
 }
Signature · 1 line
1.6.5.rc2
#6 lore raw

PATCH 6/13 twl92230: fix old style increment/decrement usage

In reply to a message not in the archive

Modern compilers do not parse "=-" as decrement:
you must use "-=" for that. Same for "=+"/"+=".

---
 hw/twl92230.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/twl92230.c +2 -2
index b15a8bf..68fab88 100644
@@ -73,14 +73,14 @@ static inline void menelaus_update(MenelausState *s)
 
 static inline void menelaus_rtc_start(MenelausState *s)
 {
-    s->rtc.next =+ qemu_get_clock(rt_clock);
+    s->rtc.next += qemu_get_clock(rt_clock);
     qemu_mod_timer(s->rtc.hz_tm, s->rtc.next);
 }
 
 static inline void menelaus_rtc_stop(MenelausState *s)
 {
     qemu_del_timer(s->rtc.hz_tm);
-    s->rtc.next =- qemu_get_clock(rt_clock);
+    s->rtc.next -= qemu_get_clock(rt_clock);
     if (s->rtc.next < 1)
         s->rtc.next = 1;
 }
Signature · 1 line
1.6.5.rc2
#7 lore raw

PATCH 7/13 linux-user: fix old style decrement usage

In reply to a message not in the archive

Modern compilers do not parse "=-" as decrement:
you must use "-=" for that.

---
 linux-user/arm/nwfpe/fpa11.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
linux-user/arm/nwfpe/fpa11.c +1 -1
index 3ff80eb..c4461e0 100644
@@ -191,7 +191,7 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)
   if(nRc == 1 && get_float_exception_flags(&fpa11->fp_status))
   {
     //printf("fef 0x%x\n",float_exception_flags);
-    nRc=-get_float_exception_flags(&fpa11->fp_status);
+    nRc -= get_float_exception_flags(&fpa11->fp_status);
   }
 
   //printf("returning %d\n",nRc);
Signature · 1 line
1.6.5.rc2
#8 lore raw

PATCH 8/13 target-mips: unmatched brackets in if 0

In reply to a message not in the archive

Fix unmatched braket in commented out code

---
 target-mips/helper.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
target-mips/helper.c +0 -1
index 7369025..7f659ae 100644
@@ -195,7 +195,6 @@ static int get_physical_address (CPUState *env, target_ulong *physical,
 #if 0
     qemu_log(TARGET_FMT_lx " %d %d => " TARGET_FMT_lx " %d (%d)\n",
             address, rw, access_type, *physical, *prot, ret);
-    }
 #endif
 
     return ret;
Signature · 1 line
1.6.5.rc2
#9 lore raw

PATCH 9/13 tests: unmatched brackets in if 0

In reply to a message not in the archive

Fix unmatched braket in commented out code

---
 tests/sha1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tests/sha1.c +1 -1
index 2557344..3a76555 100644
@@ -190,7 +190,7 @@ unsigned char c;
 	int j;
 
 	for (j = 0; j < 4; t >>= 8, j++)
-	    *--fcp = (unsigned char) t
+	    *--fcp = (unsigned char) t;
     }
 #else
     for (i = 0; i < 8; i++) {
Signature · 1 line
1.6.5.rc2
#12 lore raw

PATCH 10/13 linux-user: fix coding style nit

In reply to a message not in the archive

Put space between = and & when taking a pointer,
to avoid confusion with old-style "&=".

---
 linux-user/syscall.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
linux-user/syscall.c +1 -1
index b42567c..bf06d14 100644
@@ -2067,7 +2067,7 @@ static inline abi_long target_to_host_ipc_perm(struct ipc_perm *host_ip,
 
     if (!lock_user_struct(VERIFY_READ, target_sd, target_addr, 1))
         return -TARGET_EFAULT;
-    target_ip=&(target_sd->sem_perm);
+    target_ip = &(target_sd->sem_perm);
     host_ip->__key = tswapl(target_ip->__key);
     host_ip->uid = tswapl(target_ip->uid);
     host_ip->gid = tswapl(target_ip->gid);
Signature · 1 line
1.6.5.rc2
#13 lore raw

PATCH 11/13 net: fix coding style nit

In reply to a message not in the archive

Put space between = and - assigning a negative number to avoid confusion with old-style "-="
(which we also have, and need to be fixed).

---
 net.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net.c +1 -1
index 3fdf1e6..2686f78 100644
@@ -2044,7 +2044,7 @@ static NetSocketState *net_socket_fd_init(VLANState *vlan,
                                           const char *model, const char *name,
                                           int fd, int is_connected)
 {
-    int so_type=-1, optlen=sizeof(so_type);
+    int so_type = -1, optlen=sizeof(so_type);
 
     if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type,
         (socklen_t *)&optlen)< 0) {
Signature · 1 line
1.6.5.rc2
#14 lore raw

PATCH 12/13 slirp: fix unmatched bracket in if 0

In reply to a message not in the archive

Fix unmatched bracket in commented out code

---
 slirp/ip_input.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
slirp/ip_input.c +0 -2
index 35230f8..bb101da 100644
@@ -648,8 +648,6 @@ typedef u_int32_t n_time;
 		ip_forward(m, 1);
 		return (1);
 	}
-		}
-	}
 	return (0);
 bad:
  	icmp_error(m, type, code, 0, 0);
Signature · 1 line
1.6.5.rc2
#15 lore raw

PATCH 13/13 escc: fix another coding style nit

In reply to a message not in the archive

Fix another place with =- to be "= -".
to avoid confusion with old-style "-="
(which we also have, and needs to be fixed).

---
 hw/escc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/escc.c +2 -2
index cb34d7d..382719d 100644
@@ -878,9 +878,9 @@ static void sunmouse_event(void *opaque,
     ch = -dy;
 
     if (ch > 127)
-        ch=127;
+        ch = 127;
     else if (ch < -127)
-        ch=-127;
+        ch = -127;
 
     put_queue(s, ch & 0xff);
 
Signature · 1 line
1.6.5.rc2
#10 lore raw

[Qemu-devel] Re: [PATCH 09/13] tests: unmatched brackets in if 0

In reply to Michael S. Tsirkin
Quoted 4 lines · Michael S. Tsirkin

Fix unmatched braket in commented out code

-           *--fcp = (unsigned char) t
+           *--fcp = (unsigned char) t;

Description does not match patch content.

Applied others, thanks!

#11 lore raw

Re: [Qemu-devel] [PATCH 09/13] tests: unmatched brackets in if 0

In reply to Michael S. Tsirkin
Quoted 12 lines · Michael S. Tsirkin

Fix unmatched braket in commented out code

---
 tests/sha1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tests/sha1.c +0 -0
index 2557344..3a76555 100644

tests/sha1.c unsigned char c; · line 196

Quoted 8 lines
tests/sha1.c +1 -1
@@ -190,7 +190,7 @@ unsigned char c;
 	int j;
 
 	for (j = 0; j < 4; t >>= 8, j++)
-	    *--fcp = (unsigned char) t
+	    *--fcp = (unsigned char) t;
     }
 #else
     for (i = 0; i < 8; i++) {

Good fix, bad commit message :)