ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Problems building register.c with older glib g_async_queue_t

From: João Valverde <joao.valverde@xxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Nov 2017 21:27:17 +0000


On 24-11-2017 20:38, Gisle Vanem wrote:
João Valverde wrote:

      if (!g_file_get_contents(list, &contents, NULL, NULL))
          return;
-    for (arg = strtok(contents, " \n"); arg != NULL; arg = strtok(NULL, " \n")) { +    for (arg = strtok(contents, " \r\n"); arg != NULL; arg = strtok(NULL, " \r\n")) {
          scan_file(arg, protos, handoffs);
      }
      g_free(contents);


The newline was only being used on Unixes as the last character in a space-separated string (so that wasn't an issue) but now the token has been changed to newlines on all platforms and your reminder was helpful. Thanks.

But now this has changed this into 'strtok(SEP)' i.e. "\r\n".
Why not " \r\n" (Win32) and " \n" (else-where)? I don't see any
files with spaces in them. And hope they will never show up...

Since for some weird reason that response-file had some extra
spaces (maybe a Cmake issue?).


I'm not sure I understood the point you are trying to make, but maybe consider that spaces can show up in the relative path from build dir to source dir. Not a good idea, I agree, but it's still possible.

The code was changed from spaces to newlines to a) try to be a little bit more robust if that happens and b) make the dissectors.in file readable and diffable and grepable.