# New Ticket Created by "Paul Cochrane" # Please include the string: [perl #40507] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40507 >
Hi, This patch removes occurrences of "cuddled else" in pmc files. I guess this patch should probably go in after the pmc hard tab patch I just sent in. Regards, Paul files affected: src/pmc/os.pmc src/pmc/env.pmc src/pmc/tqueue.pmc src/pmc/delegate.pmc src/pmc/fixedpmcarray.pmc src/pmc/parrotobject.pmc src/pmc/undef.pmc src/pmc/stmvar.pmc src/pmc/file.pmc src/pmc/default.pmc src/pmc/integer.pmc src/pmc/fixedbooleanarray.pmc src/dynpmc/matchrange.pmc src/dynpmc/match.pmc languages/python/pmc/pybuiltin.pmc languages/python/pmc/pygen.pmc languages/amber/lib/kernel/pmc/amber_pathname.pmc languages/cardinal/src/pmc/rubyfloat.pmc languages/tcl/src/pmc/tclfloat.pmc languages/dotnet/pmc/dotnetassembly.pmc
Index: src/pmc/os.pmc =================================================================== --- src/pmc/os.pmc (revision 14877) +++ src/pmc/os.pmc (working copy) @@ -83,7 +83,8 @@ scwd = string_from_cstring(interpreter, cwd, strlen(cwd)); mem_sys_free(cwd); return scwd; - } else { + } + else { char *errmsg = strerror(errno); real_exception(interpreter, NULL, E_SystemError, errmsg); return NULL; @@ -142,7 +143,8 @@ char *errmsg = strerror(errno); real_exception(interpreter, NULL, E_SystemError, errmsg); } - } else { + } + else { error = remove(cpath); string_cstring_free(cpath); if (error) { Index: src/pmc/env.pmc =================================================================== --- src/pmc/env.pmc (revision 14877) +++ src/pmc/env.pmc (working copy) @@ -138,7 +138,8 @@ case KEY_integer_FLAG: if(PMC_int_val(key) < 0) { retval = string_from_cstring(interpreter, "", 0); - } else { + } + else { envp = environ[PMC_int_val(key)]; p = strchr(envp, '='); retval = string_from_cstring(interpreter, envp, (p-envp)); @@ -152,10 +153,12 @@ string_cstring_free(keyname); if (val) { retval = string_from_cstring(interpreter, val, 0); - } else { + } + else { retval = string_from_cstring(interpreter, "", 0); } - } else { + } + else { retval = string_from_cstring(interpreter, "", 0); } if (free_it && val) mem_sys_free(val); @@ -187,10 +190,12 @@ string_cstring_free(keyname); if (val) { retval = string_from_cstring(INTERP, val, 0); - } else { + } + else { retval = string_from_cstring(INTERP, "", 0); } - } else { + } + else { retval = string_from_cstring(INTERP, "", 0); } if (free_it && val) mem_sys_free(val); Index: src/pmc/tqueue.pmc =================================================================== --- src/pmc/tqueue.pmc (revision 14877) +++ src/pmc/tqueue.pmc (working copy) @@ -197,7 +197,8 @@ if (queue->tail) { queue->tail->next = entry; queue->tail = entry; - } else { + } + else { queue->head = entry; queue->tail = entry; } Index: src/pmc/delegate.pmc =================================================================== --- src/pmc/delegate.pmc (revision 14877) +++ src/pmc/delegate.pmc (working copy) @@ -74,7 +74,8 @@ get_attrib_num((SLOTTYPE *)PMC_data(class), PCD_CLASS_NAME))) ); - } else { + } + else { real_exception(interpreter, NULL, E_LookupError, "Can't find method '%s' - erroneous PMC", string_to_cstring(interpreter, meth) Index: src/pmc/fixedpmcarray.pmc =================================================================== --- src/pmc/fixedpmcarray.pmc (revision 14877) +++ src/pmc/fixedpmcarray.pmc (working copy) @@ -534,7 +534,8 @@ nextkey = key_next(INTERP, key); if (nextkey == NULL) { DYNSELF.set_number_keyed_int(k, value); - } else { + } + else { PMC* box; box = SELF.get_pmc_keyed_int(k); @@ -627,7 +628,8 @@ nextkey = key_next(INTERP, key); if (!nextkey) { DYNSELF.set_pmc_keyed_int(k, value); - } else { + } + else { PMC* box; box = SELF.get_pmc_keyed_int(k); Index: src/pmc/parrotobject.pmc =================================================================== --- src/pmc/parrotobject.pmc (revision 14877) +++ src/pmc/parrotobject.pmc (working copy) @@ -184,7 +184,8 @@ PMC* get_class() { if (!PObj_is_PMC_shared_TEST(SELF)) { return GET_CLASS(PMC_data(SELF), SELF); - } else { + } + else { /* get the class object for this interpreter */ /* XXX this is rather a hack, it is, however, necessary: * otherwise we will be accessing the wrong interpreter's Index: src/pmc/undef.pmc =================================================================== --- src/pmc/undef.pmc (revision 14877) +++ src/pmc/undef.pmc (working copy) @@ -84,7 +84,8 @@ PMC* share_ro () { if (PObj_is_PMC_shared_TEST(SELF)) { return SELF; - } else { + } + else { return pt_shared_fixup(INTERP, SELF); } } Index: src/pmc/stmvar.pmc =================================================================== --- src/pmc/stmvar.pmc (revision 14877) +++ src/pmc/stmvar.pmc (working copy) @@ -50,7 +50,8 @@ if ( value->vtable->base_type == enum_class_STMRef || value->vtable->base_type == enum_class_STMVar) { PMC_struct_val(SELF) = PMC_struct_val(value); - } else { + } + else { PMC_struct_val(SELF) = Parrot_STM_alloc(INTERP, value); } PObj_custom_mark_SET(SELF); Index: src/pmc/file.pmc =================================================================== --- src/pmc/file.pmc (revision 14877) +++ src/pmc/file.pmc (working copy) @@ -103,7 +103,8 @@ if (S_ISDIR(info.st_mode)) { return 1; - } else { + } + else { return 0; } } @@ -134,7 +135,8 @@ if (S_ISREG(info.st_mode)) { return 1; - } else { + } + else { return 0; } } @@ -165,7 +167,8 @@ if (S_ISLNK(info.st_mode)) { return 1; - } else { + } + else { return 0; } #endif @@ -212,12 +215,14 @@ } } fclose(target); - } else { + } + else { char *errmsg = strerror(errno); real_exception(interpreter, NULL, E_SystemError, errmsg); } fclose(source); - } else { + } + else { char *errmsg = strerror(errno); real_exception(interpreter, NULL, E_SystemError, errmsg); } Index: src/pmc/default.pmc =================================================================== --- src/pmc/default.pmc (revision 14877) +++ src/pmc/default.pmc (working copy) @@ -187,7 +187,8 @@ ret_val = pmc_new(interpreter, enum_class_Integer); PMC_int_val(ret_val) = 1; return ret_val; - } else + } + else return PMCNULL; } @@ -365,7 +366,8 @@ if (SELF->pmc_ext && PMC_metadata(SELF)) { VTABLE_set_pmc_keyed_str(INTERP, PMC_metadata(SELF), key, value); - } else { + } + else { PMC *prop; prop = make_prop_hash(INTERP, SELF); Index: src/pmc/integer.pmc =================================================================== --- src/pmc/integer.pmc (revision 14877) +++ src/pmc/integer.pmc (working copy) @@ -1106,7 +1106,8 @@ const INTVAL idiff = PMC_int_val(SELF) - VTABLE_get_integer(INTERP, value); return idiff > 0 ? 1 : idiff < 0 ? -1 : 0; - } else { + } + else { return fdiff > 0 ? 1 : -1; } } @@ -1140,7 +1141,8 @@ const INTVAL idiff = PMC_int_val(SELF) - VTABLE_get_integer(INTERP, value); return idiff > 0 ? 1 : idiff < 0 ? -1 : 0; - } else { + } + else { return fdiff > 0 ? 1 : -1; } } Index: src/pmc/fixedbooleanarray.pmc =================================================================== --- src/pmc/fixedbooleanarray.pmc (revision 14877) +++ src/pmc/fixedbooleanarray.pmc (working copy) @@ -340,7 +340,8 @@ if ( value ) { sd[key/BITS_PER_CHAR] |= ( 1 << ( key % BITS_PER_CHAR ) ); - } else { + } + else { sd[key/BITS_PER_CHAR] &= ( ~ ( 1 << ( key % BITS_PER_CHAR ) ) ); } } Index: src/dynpmc/matchrange.pmc =================================================================== --- src/dynpmc/matchrange.pmc (revision 14877) +++ src/dynpmc/matchrange.pmc (working copy) @@ -177,7 +177,8 @@ INTVAL get_integer_keyed (PMC* key) { if (key_type(INTERP, key) == KEY_integer_FLAG) { return SELF.get_integer_keyed_int(PMC_int_val(key)); - } else { + } + else { STRING* s = VTABLE_get_string(INTERP, key); return DYNSELF.get_integer_keyed_str(s); } @@ -303,7 +304,8 @@ void set_integer_keyed (PMC* key, INTVAL value) { if (key_type(INTERP, key) == KEY_integer_FLAG) { SELF.set_integer_keyed_int(PMC_int_val(key), value); - } else { + } + else { STRING* s = VTABLE_get_string(INTERP, key); DYNSELF.set_integer_keyed_str(s, value); } Index: src/dynpmc/match.pmc =================================================================== --- src/dynpmc/match.pmc (revision 14877) +++ src/dynpmc/match.pmc (working copy) @@ -68,7 +68,8 @@ { if (val->vtable->base_type == MatchRange_type_id) { return match_range(interp, matchobj, val); - } else { + } + else { return VTABLE_get_string(interp, val); } } @@ -78,7 +79,8 @@ if (val->vtable->base_type == MatchRange_type_id) { STRING* valstr = match_range(interp, matchobj, val); return string_to_int(interp, valstr); - } else { + } + else { return VTABLE_get_integer(interp, val); } } Index: languages/python/pmc/pybuiltin.pmc =================================================================== --- languages/python/pmc/pybuiltin.pmc (revision 14877) +++ languages/python/pmc/pybuiltin.pmc (working copy) @@ -575,7 +575,8 @@ VTABLE_get_string(INTERP, name)); if (attr && VTABLE_defined(INTERP, attr)) VTABLE_set_integer_native(INTERP, ret, 1); - } else { + } + else { if (INTERP->exceptions->error != E_AttributeError) { handle_exception(INTERP); } Index: languages/python/pmc/pygen.pmc =================================================================== --- languages/python/pmc/pygen.pmc (revision 14877) +++ languages/python/pmc/pygen.pmc (working copy) @@ -110,7 +110,8 @@ push_new_c_exception_handler(INTERP, INTERP->exceptions); if (!setjmp(INTERP->exceptions->destination)) { PMC_struct_val(SELF) = PyGen_next(INTERP, SELF); - } else { + } + else { Parrot_exception *exception = INTERP->exceptions; if (exception->error != E_StopIteration) { rethrow_c_exception(INTERP); Index: languages/amber/lib/kernel/pmc/amber_pathname.pmc =================================================================== --- languages/amber/lib/kernel/pmc/amber_pathname.pmc (revision 14877) +++ languages/amber/lib/kernel/pmc/amber_pathname.pmc (working copy) @@ -103,7 +103,8 @@ index++; } (void) closedir(dp); - } else { + } + else { real_exception( INTERP, NULL, E_IOError, "PATHNAME.entry_names: couldn't read directory" @@ -136,7 +137,8 @@ } } (void) closedir(dp); - } else { + } + else { real_exception( INTERP, NULL, E_IOError, "PATHNAME.file_names: couldn't read directory" @@ -178,7 +180,8 @@ } } (void) closedir(dp); - } else { + } + else { real_exception( INTERP, NULL, E_IOError, "PATHNAME.file_names: couldn't read directory" @@ -196,7 +199,8 @@ if (dp != NULL) { VTABLE_set_integer_native(INTERP, result, 1); (void) closedir(dp); - } else { + } + else { VTABLE_set_integer_native(INTERP, result, 0); } return result; @@ -239,7 +243,8 @@ } } (void) closedir(dp); - } else { + } + else { real_exception( INTERP, NULL, E_IOError, "PATHNAME.subdirectory_names: couldn't read directory" @@ -281,7 +286,8 @@ } } (void) closedir(dp); - } else { + } + else { real_exception( INTERP, NULL, E_IOError, "PATHNAME.subdirectory_pathnames: couldn't read directory" Index: languages/cardinal/src/pmc/rubyfloat.pmc =================================================================== --- languages/cardinal/src/pmc/rubyfloat.pmc (revision 14877) +++ languages/cardinal/src/pmc/rubyfloat.pmc (working copy) @@ -34,7 +34,8 @@ while (buflen) { if (string_index(INTERP,buff,buflen-1) == '0') { buflen--; - } else { + } + else { break; } } Index: languages/tcl/src/pmc/tclfloat.pmc =================================================================== --- languages/tcl/src/pmc/tclfloat.pmc (revision 14877) +++ languages/tcl/src/pmc/tclfloat.pmc (working copy) @@ -64,7 +64,8 @@ if (string_index(INTERP,buff,buflen-1) == '0') { buflen--; check_flag = 1; - } else { + } + else { break; } } Index: languages/dotnet/pmc/dotnetassembly.pmc =================================================================== --- languages/dotnet/pmc/dotnetassembly.pmc (revision 14877) +++ languages/dotnet/pmc/dotnetassembly.pmc (working copy) @@ -322,7 +322,8 @@ /* Found header. Seek to it and return success. */ fseek(in, cli_header_filepos, SEEK_SET); return 1; - } else { + } + else { /* Couldn't locate the CLI header. */ real_exception(INTERP, NULL, E_StandardError, "Cannot locate CLI header in PE file"); @@ -365,7 +366,8 @@ /* Found metadata root. Seek to it and return success. */ fseek(in, metadata_filepos, SEEK_SET); return 1; - } else { + } + else { /* Couldn't locate the metadata root. */ real_exception(INTERP, NULL, E_StandardError, "Cannot locate CLI metadata root"); @@ -2032,7 +2034,8 @@ (ass->user_strings[i+2] << 8) + ass->user_strings[i+3]; start = i + 4; - } else { + } + else { real_exception(INTERP, NULL, E_StandardError, "Unable to decode user string length"); return NULL; @@ -2091,7 +2094,8 @@ length = ((ass->blobs[i] & 0x1F) << 24) + (ass->blobs[i+1] << 16) + (ass->blobs[i+2] << 8) + ass->blobs[i+3]; start = i + 4; - } else { + } + else { real_exception(INTERP, NULL, E_StandardError, "Unable to decode blob length"); return NULL;