summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2010-05-12 19:35:09 +0200
committerJohannes Weiner <hannes@cmpxchg.org>2010-05-12 19:35:09 +0200
commit576c7110deb6d92f148aa0ce3ca8fc351912ade7 (patch)
tree437c4ad4c94f14947db9c980e81bb0e61ff8c2f2
parentf692322b86e0f3ed4294d9989b28b92686989767 (diff)
function: print plain function name in !repr mode
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
-rw-r--r--sheep/function.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sheep/function.c b/sheep/function.c
index b840ec6..f3a6808 100644
--- a/sheep/function.c
+++ b/sheep/function.c
@@ -57,10 +57,17 @@ static void function_format(sheep_t sheep, struct sheep_strbuf *sb, int repr)
struct sheep_function *function;
function = sheep_function(sheep);
- if (function->name)
- sheep_strbuf_addf(sb, "#<function '%s'>", function->name);
- else
- sheep_strbuf_addf(sb, "#<function '%p'>", function);
+ if (repr) {
+ if (function->name)
+ sheep_strbuf_addf(sb, "#<function '%s'>", function->name);
+ else
+ sheep_strbuf_addf(sb, "#<function '%p'>", function);
+ } else {
+ if (function->name)
+ sheep_strbuf_add(sb, function->name);
+ else
+ sheep_strbuf_add(sb, "<anonymous function>");
+ }
}
const struct sheep_type sheep_function_type = {