|
From: <sv...@va...> - 2015-06-26 11:00:54
|
Author: florian
Date: Fri Jun 26 12:00:47 2015
New Revision: 15356
Log:
Use switch statement instead of if-else-cascade.
Modified:
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c Fri Jun 26 12:00:47 2015
@@ -271,7 +271,6 @@
/* Limits etc */
-
Addr VG_(clo_aspacem_minAddr)
#if defined(VGO_darwin)
# if VG_WORDSIZE == 4
@@ -2921,15 +2920,15 @@
/* NSegments segLo .. segHi inclusive should agree with the presented
data. */
for (const NSegment *seg = segLo; seg <= segHi; seg++) {
-
- UInt seg_prot;
-
- if (seg->kind == SkAnonV || seg->kind == SkFileV) {
+ switch (seg->kind) {
+ case SkAnonV:
+ case SkFileV:
/* Ignore V regions */
- continue;
- }
- else if (seg->kind == SkFree || seg->kind == SkResvn) {
- /* Add mapping for SkResvn regions */
+ break;
+
+ case SkFree:
+ case SkResvn: {
+ /* Add mapping */
ChangedSeg* cs = &css_local[css_used_local];
if (css_used_local < css_size_local) {
cs->is_added = True;
@@ -2942,15 +2941,15 @@
css_overflowed = True;
}
return;
-
}
- else if (seg->kind == SkAnonC ||
- seg->kind == SkFileC ||
- seg->kind == SkShmC)
- {
+
+ case SkAnonC:
+ case SkFileC:
+ case SkShmC: {
/* Check permissions on client regions */
// GrP fixme
- seg_prot = 0;
+ UInt seg_prot = 0;
+
if (seg->hasR) seg_prot |= VKI_PROT_READ;
if (seg->hasW) seg_prot |= VKI_PROT_WRITE;
# if defined(VGA_x86)
@@ -2979,10 +2978,11 @@
css_overflowed = True;
}
return;
-
}
+ break;
+ }
- } else {
+ default:
aspacem_assert(0);
}
}
|