Ticket #8990: 0001-Making-code-more-readable-and-removing-extra-parenthesis-gsoc2015.patch

File 0001-Making-code-more-readable-and-removing-extra-parenthesis-gsoc2015.patch, 1.7 KB (added by kushalsingh007, 9 years ago)

Seperate Patch for removing extra parentheisis and making code more readable by breaking into multiple conditions.

  • src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp

    From 39e0011484d48b9e7c7b88c6efd4c61c6984d476 Mon Sep 17 00:00:00 2001
    From: kushalsingh007 <kushal.spiderman.singh@gmail.com>
    Date: Mon, 26 Jan 2015 11:35:53 +0530
    Subject: [PATCH] * Making code more readable and removing extra parenthesis.
    
    ---
     src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp | 20 ++++++++++++--------
     1 file changed, 12 insertions(+), 8 deletions(-)
    
    diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
    index e34a03b..22313cf 100644
    a b status_t  
    106106PartitionMapAddOn::ValidateInitialize(const BMutablePartition* partition,
    107107    BString* name, const char* parameters)
    108108{
    109     if ((!CanInitialize(partition))
    110         || (parameters == NULL) || (parameters[0] == '\0')) {
     109    if (!CanInitialize(partition))
     110        return B_BAD_VALUE;
     111       
     112    if (parameters == NULL || parameters[0] == '\0')
    111113        return B_BAD_VALUE;
    112     }
    113114
    114115    // we don't support a content name
    115116    if (name != NULL)
    status_t  
    123124PartitionMapAddOn::Initialize(BMutablePartition* partition, const char* name,
    124125    const char* parameters, BPartitionHandle** _handle)
    125126{
    126     if ((!CanInitialize(partition))
    127         || (name == NULL) || (name[0] == '\0')
    128         || (parameters == NULL) || (parameters[0] == '\0')) {
     127    if (!CanInitialize(partition))
    129128        return B_BAD_VALUE;
    130     }
    131 
     129   
     130    if (name == NULL || name[0] == '\0')
     131        return B_BAD_VALUE;
     132       
     133    if (parameters == NULL || parameters[0] == '\0')
     134        return B_BAD_VALUE;
     135       
    132136    // create the handle
    133137    PartitionMapHandle* handle = new(nothrow) PartitionMapHandle(partition);
    134138    if (!handle)