)]}'
{
  "commit": "c3864c822b190dfbef48b0459222a08467f94cfb",
  "tree": "8b3a498944772040058f52d5292d7820eeeb150b",
  "parents": [
    "d5bb64b3dc438a0a03c66d08a7fd12de5543f538"
  ],
  "author": {
    "name": "Chris Dickens",
    "email": "christopher.a.dickens@gmail.com",
    "time": "Thu Jan 23 16:18:24 2020 -0800"
  },
  "committer": {
    "name": "Chris Dickens",
    "email": "christopher.a.dickens@gmail.com",
    "time": "Fri Jan 24 11:22:52 2020 -0800"
  },
  "message": "linux_usbfs: Clean up inconsistencies and optimize memory usage\n\nThe formatting and coding style varied across the whole file. Adopt the\nfollowing consistent style:\n\n  - Align function arguments to the opening parenthesis\n  - Do not check for NULL before calling free()\n  - Reduce indentation where possible in loops by continuing in the\n    success case\n  - Remove space between function name and opening parenthesis\n  - Remove pointless pointer casts from void *\n  - Replace comparisons with NULL or 0 by a negation operator\n  - When comparing against rvalues, place the rvalue on the right side\n    of the expression\n  - Where possible, have the debug message string on the same line as\n    the usbi_* call. This makes it easier to grep for specific strings.\n\nAlso update the definitions in linux_usbfs.h to exactly match that of\nthe kernel and remove definitions that are not needed.\n\nA number of functions declared stack buffers of size PATH_MAX. This is\ngenerally 4K, which is very much overkill for a lot of the strings and\nis not friendly for embedded environments. Replace many of these buffers\nwith reasonably-sized ones, in many cases using exactly the size needed.\n\nWhen reading the descriptors during device enumeration, we were starting\nwith a 1K buffer and doubling as needed. The vast majority of devices\nwill not have a large set of descriptors, so change the allocation logic\nto grow the buffer in steps of 256 bytes.\n\nIntroduce a new parsing function for reading sysfs attributes. Using the\nfdopen() function to use fscanf() results in excessive memory\nallocation, one for the FILE object and another for the buffer into\nwhich the C library will read the data. The sysfs attributes of interest\nare generally just a few characters, so use a small stack buffer and\nsome rigorous parsing to read these attributes. This also consolidates\nerror checking (e.g. negative values or larger than expected values).\n\nSigned-off-by: Chris Dickens \u003cchristopher.a.dickens@gmail.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "33affb0615658dee728715bcc0d7f06f073fa435",
      "old_mode": 33188,
      "old_path": "libusb/os/linux_usbfs.c",
      "new_id": "58d5f6ccd06e6eb6781221bd7fb68fc609c9a3a7",
      "new_mode": 33188,
      "new_path": "libusb/os/linux_usbfs.c"
    },
    {
      "type": "modify",
      "old_id": "a57eb413b6cdcc0eaed39ffeeedfc4e3dedb3189",
      "old_mode": 33188,
      "old_path": "libusb/os/linux_usbfs.h",
      "new_id": "91d3f490888daa20c6c6c26a8b10e2bcc26a77d2",
      "new_mode": 33188,
      "new_path": "libusb/os/linux_usbfs.h"
    },
    {
      "type": "modify",
      "old_id": "f27fa5ea5b73c348b5038a2cd4d7ff4dce3f0338",
      "old_mode": 33188,
      "old_path": "libusb/version_nano.h",
      "new_id": "7a1f0581ea6e32f1a9e2b76733afe560a79a3d04",
      "new_mode": 33188,
      "new_path": "libusb/version_nano.h"
    }
  ]
}
