Skip to content
Snippets Groups Projects
  1. Jul 17, 2017
    • Colin Walters's avatar
      fdio: Add cleanup+flush API for FILE* · e30a773f
      Colin Walters authored
      Mostly in ostree/rpm-ostree, we work in either raw `int fd`, or
      `G{Input,Output}Stream`.  One exception is the rpm-ostree `/etc/passwd`
      handling, which uses `FILE*` since that's what glibc exposes.
      
      And in general, there are use cases for `FILE*`; the raw `GUnixOutputStream` for
      example isn't buffered, and doing so via e.g. `GBufferedOutputStream` means
      allocating *two* GObjects and even worse going through multiple vfuncs for every
      write.
      
      `FILE*` is used heavily in systemd, and provides buffering. It is a bit cheaper
      than gobjects, but has its own trap; by default every operation locks a mutex.
      For more information on that, see `unlocked_stdio(3)`. However, callers can
      avoid that by using e.g. `fwrite_unlocked`, which I plan to do for most users of
      `FILE*` that aren't writing to one of the standard streams like `stdout` etc.
      e30a773f
  2. Jul 10, 2017
  3. Jun 28, 2017
  4. Jun 26, 2017
  5. Jun 17, 2017
  6. Jun 14, 2017
    • Colin Walters's avatar
      Add G_IN_SET, patch our internal users via spatch · 9a1b77ef
      Colin Walters authored
      I originally tried to get this into GLib:
      https://bugzilla.gnome.org/show_bug.cgi?id=783751
      
      But that looks like it's going to fail due to MSVC. Let's add it here at least
      so I can start using it tomorrow and not wait for the MSVC team to catch up.
      
      I renamed `glnx-alloca.h` to `glnx-macros.h` as a more natural collective
      home for things from systemd's `macro.h`.
      
      Finally, I used a Coccinelle spatch similar to the one referenced
      in the above BZ to patch our uses.
      9a1b77ef
  7. May 11, 2017
  8. Apr 21, 2017
  9. Mar 24, 2017
  10. Mar 23, 2017
    • Jonathan Lebon's avatar
      glnx-errors.h: add glnx_null_throw[_*] variants · 0c52d85e
      Jonathan Lebon authored
      These are equivalent to the non-null throw, except that the returned
      value is a NULL pointer. They can be used in functions where one wants
      to return a pointer. E.g.:
      
      	GKeyFile *foo(GError **error) {
      		return glnx_null_throw (error, "foobar");
      	}
      
      The function call redirections are wrapped around a compound statement
      expression[1] so that they represent a single top-level expression. This
      allows us to avoid -Wunused-value warnings vs using a comma operator if
      the return value isn't used.
      
      I made the 'args...' absorb the fmt argument as well so that callers can
      still use it without always having to specify at least one additional
      variadic argument. I had to check to be sure that the expansion is all
      done by the preprocessor, so we don't need to worry about stack
      intricacies.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
      0c52d85e
  11. Mar 22, 2017
  12. Mar 02, 2017
  13. Feb 21, 2017
    • Colin Walters's avatar
      tests/xattrs: Fix possible NULL allocation · 0c1603de
      Colin Walters authored
      This showed up in the ostree runs with `-fsanitize=undefined` - if we happened
      to get `0` then `g_malloc` would return `NULL`. However, what's interesting is
      it seemed to happen *consistently*. I think what's going on is GCC proved that
      the value *could* be zero, and hence it *could* return NULL, and hence it was
      undefined behavior. Hooray for `-fsanitize=undefined`.
      0c1603de
  14. Jan 29, 2017
Loading