+2019-11-06 Christian Biesinger <cbiesinger@google.com>
+
+ * linux-tdep.c (linux_info_proc): Use strtok_r instead of strtok.
+ * mi/mi-main.c (output_cores): Likewise.
+ * nat/linux-osdata.c (linux_xfer_osdata_cpus): Likewise.
+ (linux_xfer_osdata_modules): Likewise.
+ * remote.c (register_remote_support_xml): Likewise.
+ * sparc64-tdep.c (adi_is_addr_mapped): Likewise.
+ * xml-syscall.c (syscall_create_syscall_desc): Likewise.
+
2019-11-06 Tom Tromey <tom@tromey.com>
* tui/tui-interp.c: Don't include readline.h.
+2019-11-06 Christian Biesinger <cbiesinger@google.com>
+
+ * linux-tdep.c (linux_info_proc): Use strtok_r instead of strtok.
+ * mi/mi-main.c (output_cores): Likewise.
+ * nat/linux-osdata.c (linux_xfer_osdata_cpus): Likewise.
+ (linux_xfer_osdata_modules): Likewise.
+ * remote.c (register_remote_support_xml): Likewise.
+ * sparc64-tdep.c (adi_is_addr_mapped): Likewise.
+ * xml-syscall.c (syscall_create_syscall_desc): Likewise.
+
2019-11-01 Christian Biesinger <cbiesinger@google.com>
* configure: Regenerate.
if (startswith (feature, "xmlRegisters="))
{
char *copy = xstrdup (feature + 13);
- char *p;
- for (p = strtok (copy, ","); p != NULL; p = strtok (NULL, ","))
+ char *saveptr;
+ for (char *p = strtok_r (copy, ",", &saveptr);
+ p != NULL;
+ p = strtok_r (NULL, ",", &saveptr))
{
if (strcmp (p, "i386") == 0)
{
/* Two passes, to avoid nested strtok calls in
target_process_qsupported. */
- for (p = strtok (p + 1, ";");
+ char *saveptr;
+ for (p = strtok_r (p + 1, ";", &saveptr);
p != NULL;
- p = strtok (NULL, ";"))
+ p = strtok_r (NULL, ";", &saveptr))
{
count++;
qsupported = XRESIZEVEC (char *, qsupported, count);
}
else if (startswith (*next_arg, "--disable-packet="))
{
- char *packets, *tok;
-
- packets = *next_arg += sizeof ("--disable-packet=") - 1;
- for (tok = strtok (packets, ",");
+ char *packets = *next_arg += sizeof ("--disable-packet=") - 1;
+ char *saveptr;
+ for (char *tok = strtok_r (packets, ",", &saveptr);
tok != NULL;
- tok = strtok (NULL, ","))
+ tok = strtok_r (NULL, ",", &saveptr))
{
if (strcmp ("vCont", tok) == 0)
disable_packet_vCont = true;
" Size", " Offset", "objfile");
}
- for (line = strtok (map.get (), "\n");
+ char *saveptr;
+ for (line = strtok_r (map.get (), "\n", &saveptr);
line;
- line = strtok (NULL, "\n"))
+ line = strtok_r (NULL, "\n", &saveptr))
{
ULONGEST addr, endaddr, offset, inode;
const char *permissions, *device, *mapping_filename;
ui_out_emit_list list_emitter (uiout, field_name);
auto cores = make_unique_xstrdup (xcores);
char *p = cores.get ();
+ char *saveptr;
- for (p = strtok (p, ","); p; p = strtok (NULL, ","))
+ for (p = strtok_r (p, ",", &saveptr); p; p = strtok_r (NULL, ",", &saveptr))
uiout->field_string (NULL, p);
}
char *key, *value;
int i = 0;
- key = strtok (buf, ":");
+ char *saveptr;
+ key = strtok_r (buf, ":", &saveptr);
if (key == NULL)
continue;
- value = strtok (NULL, ":");
+ value = strtok_r (NULL, ":", &saveptr);
if (value == NULL)
continue;
{
if (fgets (buf, sizeof (buf), fp.get ()))
{
- char *name, *dependencies, *status, *tmp;
+ char *name, *dependencies, *status, *tmp, *saveptr;
unsigned int size;
unsigned long long address;
int uses;
- name = strtok (buf, " ");
+ name = strtok_r (buf, " ", &saveptr);
if (name == NULL)
continue;
- tmp = strtok (NULL, " ");
+ tmp = strtok_r (NULL, " ", &saveptr);
if (tmp == NULL)
continue;
if (sscanf (tmp, "%u", &size) != 1)
continue;
- tmp = strtok (NULL, " ");
+ tmp = strtok_r (NULL, " ", &saveptr);
if (tmp == NULL)
continue;
if (sscanf (tmp, "%d", &uses) != 1)
continue;
- dependencies = strtok (NULL, " ");
+ dependencies = strtok_r (NULL, " ", &saveptr);
if (dependencies == NULL)
continue;
- status = strtok (NULL, " ");
+ status = strtok_r (NULL, " ", &saveptr);
if (status == NULL)
continue;
- tmp = strtok (NULL, "\n");
+ tmp = strtok_r (NULL, "\n", &saveptr);
if (tmp == NULL)
continue;
if (sscanf (tmp, "%llx", &address) != 1)
else
{
char *copy = xstrdup (remote_support_xml + 13);
- char *p = strtok (copy, ",");
+ char *saveptr;
+ char *p = strtok_r (copy, ",", &saveptr);
do
{
return;
}
}
- while ((p = strtok (NULL, ",")) != NULL);
+ while ((p = strtok_r (NULL, ",", &saveptr)) != NULL);
xfree (copy);
remote_support_xml = reconcat (remote_support_xml,
if (data)
{
adi_stat_t adi_stat = get_adi_info (pid);
- char *line;
- for (line = strtok (data.get (), "\n"); line; line = strtok (NULL, "\n"))
+ char *saveptr;
+ for (char *line = strtok_r (data.get (), "\n", &saveptr);
+ line;
+ line = strtok_r (NULL, "\n", &saveptr))
{
ULONGEST addr, endaddr;
/* Add syscall to its groups. */
if (groups != NULL)
{
- for (char *group = strtok (groups, ",");
+ char *saveptr;
+ for (char *group = strtok_r (groups, ",", &saveptr);
group != NULL;
- group = strtok (NULL, ","))
+ group = strtok_r (NULL, ",", &saveptr))
syscall_group_add_syscall (syscalls_info, sysdesc, group);
}
}