Commit 44107955 authored by Paolo Bosetti's avatar Paolo Bosetti

Code formatting in sprintf.c

switch/case constructs in mrb_str_format() had mismatched indentation
styles: clean up to 2-spaces-per-level.
parent 263de094
......@@ -483,7 +483,8 @@ mrb_f_sprintf(mrb_state *mrb, mrb_value obj)
if (argc <= 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "too few arguments");
return mrb_nil_value();
} else {
}
else {
return mrb_str_format(mrb, argc - 1, argv + 1, argv[0]);
}
}
......@@ -598,8 +599,7 @@ retry:
goto retry;
case '<':
case '{':
{
case '{': {
const char *start = p;
char term = (*p == '<') ? '>' : '}';
mrb_value symname;
......@@ -655,6 +655,7 @@ retry:
case '\n':
case '\0':
p--;
case '%':
if (flags != FNONE) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid format character - %%");
......@@ -662,8 +663,7 @@ retry:
PUSH("%", 1);
break;
case 'c':
{
case 'c': {
mrb_value val = GETARG();
mrb_value tmp;
unsigned int c;
......@@ -705,7 +705,7 @@ retry:
case 's':
case 'p':
format_s:
format_s:
{
mrb_value arg = GETARG();
long len, slen;
......@@ -756,8 +756,7 @@ format_s:
case 'X':
case 'b':
case 'B':
case 'u':
{
case 'u': {
mrb_value val = GETARG();
char fbuf[32], nbuf[64], *s;
const char *prefix = 0;
......@@ -793,7 +792,7 @@ format_s:
}
}
bin_retry:
bin_retry:
switch (mrb_type(val)) {
case MRB_TT_FLOAT:
if (FIXABLE(mrb_float(val))) {
......@@ -903,6 +902,7 @@ bin_retry:
pp++;
}
}
if (prefix && !prefix[1]) { /* octal */
if (dots) {
prefix = 0;
......@@ -918,9 +918,11 @@ bin_retry:
else if (len == 1 && *s == '0') {
prefix = 0;
}
if (prefix) {
width -= (int)strlen(prefix);
}
if ((flags & (FZERO|FMINUS|FPREC)) == FZERO) {
prec = width;
width = 0;
......@@ -932,19 +934,23 @@ bin_retry:
}
width -= prec;
}
if (!(flags&FMINUS)) {
CHECK(width);
while (width-- > 0) {
buf[blen++] = ' ';
}
}
if (sc) PUSH(&sc, 1);
if (prefix) {
int plen = (int)strlen(prefix);
PUSH(prefix, plen);
}
CHECK(prec - len);
if (dots) PUSH("..", 2);
if (v < 0 || (base == 2 && org_v < 0)) {
char c = sign_bits(base, p);
while (len < prec--) {
......@@ -957,6 +963,7 @@ bin_retry:
buf[blen++] = c;
}
}
PUSH(s, len);
CHECK(width);
while (width-- > 0) {
......@@ -971,8 +978,7 @@ bin_retry:
case 'e':
case 'E':
case 'a':
case 'A':
{
case 'A': {
mrb_value val = GETARG();
double fval;
int i, need = 6;
......
......@@ -195,7 +195,6 @@
88BF34E1156C998200F12AC7 /* error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = "<group>"; };
88BF34E2156C998200F12AC7 /* etc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = etc.c; sourceTree = "<group>"; };
88BF34E5156C998200F12AC7 /* gc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gc.c; sourceTree = "<group>"; };
88BF34E6156C998200F12AC7 /* gc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gc.h; sourceTree = "<group>"; };
88BF34E7156C998200F12AC7 /* hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hash.c; sourceTree = "<group>"; };
88BF34E8156C998200F12AC7 /* init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = init.c; sourceTree = "<group>"; };
88BF34EA156C998200F12AC7 /* init_ext.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = init_ext.c; sourceTree = "<group>"; };
......@@ -491,7 +490,6 @@
88BF34E1156C998200F12AC7 /* error.h */,
88BF34E2156C998200F12AC7 /* etc.c */,
88BF34E5156C998200F12AC7 /* gc.c */,
88BF34E6156C998200F12AC7 /* gc.h */,
88BF34E7156C998200F12AC7 /* hash.c */,
88BF34E8156C998200F12AC7 /* init.c */,
88BF34EA156C998200F12AC7 /* init_ext.c */,
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0440"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88760B2315769E6100113BFB"
BuildableName = "mruby"
BlueprintName = "mruby"
ReferencedContainer = "container:mruby.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88760B3215769F3000113BFB"
BuildableName = "mirb"
BlueprintName = "mirb"
ReferencedContainer = "container:mruby.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8844358E1577301B007F95A4"
BuildableName = "mrbtest"
BlueprintName = "mrbtest"
ReferencedContainer = "container:mruby.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88760B2315769E6100113BFB"
BuildableName = "mruby"
BlueprintName = "mruby"
ReferencedContainer = "container:mruby.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88760B3215769F3000113BFB"
BuildableName = "mirb"
BlueprintName = "mirb"
ReferencedContainer = "container:mruby.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "88760B2315769E6100113BFB"
BuildableName = "mruby"
BlueprintName = "mruby"
ReferencedContainer = "container:mruby.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "CLANGDebug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment