[haiku-commits] Re: haiku: hrev53386 - in src: tests/kits/shared kits/shared

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 21 Aug 2019 08:23:15 +1200

 #ifdef HAIKU_TARGET_PLATFORM_HAIKU
        key_map* keys = NULL;
-       get_key_map(&keys, &fChars);
+       ssize_t charsSize;
+
+       delete[] fChars;
+       _get_key_map(&keys, &fChars, &charsSize);
        if (!keys)
                return B_ERROR;

        memcpy(&fKeys, keys, sizeof(fKeys));
        free(keys);

-       fCharsSize = sizeof(fChars);
+       fCharsSize = (uint32)charsSize;

        return B_OK;

Out of curiosity, is there a particular reason why you can't just use
`_get_key_map(&fKeys, &fChars, &fCharsSize)` and skip the copy & free?

Other related posts: