aboutsummaryrefslogtreecommitdiff
path: root/gas/symbols.c
diff options
context:
space:
mode:
Diffstat (limited to 'gas/symbols.c')
-rw-r--r--gas/symbols.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/gas/symbols.c b/gas/symbols.c
index 4c3137a..0d5a854 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -3220,25 +3220,16 @@ symbol_relc_make_expr (expressionS * exp)
if (opstr == NULL)
concat_string = NULL;
+ else if (arity == 0)
+ concat_string = xstrdup (opstr);
+ else if (arity == 1)
+ concat_string = concat (opstr, ":", operands[0], (char *) NULL);
+ else if (arity == 2)
+ concat_string = concat (opstr, ":", operands[0], ":", operands[1],
+ (char *) NULL);
else
- {
- /* Allocate new string; include inter-operand padding gaps etc. */
- concat_string = xmalloc (strlen (opstr)
- + 1
- + (arity >= 1 ? (strlen (operands[0]) + 1 ) : 0)
- + (arity >= 2 ? (strlen (operands[1]) + 1 ) : 0)
- + (arity >= 3 ? (strlen (operands[2]) + 0 ) : 0)
- + 1);
- gas_assert (concat_string != NULL);
-
- /* Format the thing. */
- sprintf (concat_string,
- (arity == 0 ? "%s" :
- arity == 1 ? "%s:%s" :
- arity == 2 ? "%s:%s:%s" :
- /* arity == 3 */ "%s:%s:%s:%s"),
- opstr, operands[0], operands[1], operands[2]);
- }
+ concat_string = concat (opstr, ":", operands[0], ":", operands[1], ":",
+ operands[2], (char *) NULL);
/* Free operand strings (not opstr). */
if (arity >= 1) xfree (operands[0]);