+2016-04-14 Pedro Alves <palves@redhat.com>
+
+ * cli/cli-cmds.c (alias_usage_error): New function.
+ (alias_command): Use it.
+ * ctf.c (ctf_save_metadata_header): Inline metadata_fmt local in
+ ctf_save_write_metadata call.
+
2016-04-14 Pedro Alves <palves@redhat.com>
* ada-typeprint.c (print_fixed_point_type): Don't pass float as
return *command == '\0';
}
+/* Called when "alias" was incorrectly used. */
+
+static void
+alias_usage_error (void)
+{
+ error (_("Usage: alias [-a] [--] ALIAS = COMMAND"));
+}
+
/* Make an alias of an existing command. */
static void
char **alias_argv, **command_argv;
dyn_string_t alias_dyn_string, command_dyn_string;
struct cleanup *cleanup;
- static const char usage[] = N_("Usage: alias [-a] [--] ALIAS = COMMAND");
if (args == NULL || strchr (args, '=') == NULL)
- error (_(usage));
+ alias_usage_error ();
args2 = xstrdup (args);
cleanup = make_cleanup (xfree, args2);
if (alias_argv[0] == NULL || command_argv[0] == NULL
|| *alias_argv[0] == '\0' || *command_argv[0] == '\0')
- error (_(usage));
+ alias_usage_error ();
for (i = 0; alias_argv[i] != NULL; ++i)
{
static void
ctf_save_metadata_header (struct trace_write_handler *handler)
{
- const char metadata_fmt[] =
- "\ntrace {\n"
- " major = %u;\n"
- " minor = %u;\n"
- " byte_order = %s;\n" /* be or le */
- " packet.header := struct {\n"
- " uint32_t magic;\n"
- " };\n"
- "};\n"
- "\n"
- "stream {\n"
- " packet.context := struct {\n"
- " uint32_t content_size;\n"
- " uint32_t packet_size;\n"
- " uint16_t tpnum;\n"
- " };\n"
- " event.header := struct {\n"
- " uint32_t id;\n"
- " };\n"
- "};\n";
-
ctf_save_write_metadata (handler, "/* CTF %d.%d */\n",
CTF_SAVE_MAJOR, CTF_SAVE_MINOR);
ctf_save_write_metadata (handler,
#define HOST_ENDIANNESS "le"
#endif
- ctf_save_write_metadata (handler, metadata_fmt,
+ ctf_save_write_metadata (handler,
+ "\ntrace {\n"
+ " major = %u;\n"
+ " minor = %u;\n"
+ " byte_order = %s;\n"
+ " packet.header := struct {\n"
+ " uint32_t magic;\n"
+ " };\n"
+ "};\n"
+ "\n"
+ "stream {\n"
+ " packet.context := struct {\n"
+ " uint32_t content_size;\n"
+ " uint32_t packet_size;\n"
+ " uint16_t tpnum;\n"
+ " };\n"
+ " event.header := struct {\n"
+ " uint32_t id;\n"
+ " };\n"
+ "};\n",
CTF_SAVE_MAJOR, CTF_SAVE_MINOR,
HOST_ENDIANNESS);
ctf_save_write_metadata (handler, "\n");