Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2019-06-13 11:14:05 -0400
committerEugene Tarassov2019-06-13 11:14:05 -0400
commit500b45bf300fda4921424a097349232202b23d50 (patch)
treeebe04c32333ebd6adc3b8e2433dbf7481337cf15
parent30f0914f67a54acac35f7fb8a7c7a8086ed3632f (diff)
downloadorg.eclipse.tcf.agent-500b45bf300fda4921424a097349232202b23d50.tar.gz
org.eclipse.tcf.agent-500b45bf300fda4921424a097349232202b23d50.tar.xz
org.eclipse.tcf.agent-500b45bf300fda4921424a097349232202b23d50.zip
TCF Agent: removed unnecessary call of tmp_strdup() in set_errno()HEADmaster
-rw-r--r--agent/tcf/framework/errors.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/agent/tcf/framework/errors.c b/agent/tcf/framework/errors.c
index 76fc97e3..ddee358c 100644
--- a/agent/tcf/framework/errors.c
+++ b/agent/tcf/framework/errors.c
@@ -408,19 +408,16 @@ int set_errno(int no, const char * msg) {
m->text = loc_strdup(errno_to_str(no));
}
else {
- const char * text0 = tmp_strdup(msg);
- const char * text1 = errno_to_str(no);
- if (text0[msg_len - 1] == '.' || text0[msg_len - 1] == '\n') {
- size_t len = msg_len + strlen(text1) + 2;
- char * text2 = (char *)loc_alloc(len);
- snprintf(text2, len, "%s %s", text0, text1);
- m->text = text2;
+ const char * str = errno_to_str(no);
+ if (msg[msg_len - 1] == '.' || msg[msg_len - 1] == '\n') {
+ size_t len = msg_len + strlen(str) + 2;
+ m->text = (char *)loc_alloc(len);
+ snprintf(m->text, len, "%s %s", msg, str);
}
else {
- size_t len = msg_len + strlen(text1) + 3;
- char * text2 = (char *)loc_alloc(len);
- snprintf(text2, len, "%s. %s", text0, text1);
- m->text = text2;
+ size_t len = msg_len + strlen(str) + 3;
+ m->text = (char *)loc_alloc(len);
+ snprintf(m->text, len, "%s. %s", msg, str);
}
}
}

Back to the top