Skip to content
Snippets Groups Projects
  1. Mar 01, 2018
    • Michael Whittaker's avatar
      Removed `goto fail` code with `unique_ptr`. · 4ceab25d
      Michael Whittaker authored
      Previously, `UDPTransport::SendMessageInternal` dynamically allocated a
      `char[]` and used a `goto fail` to make sure that it was properly
      deleted. Something like:
      
      ```c++
          char *buf = new char[100];
          if (...) {
              ...
              goto fail;
          } else if (...) {
              ...
              goto fail;
          } else {
              ...
          }
      
      fail:
           delete [] buf;
           return false;
      ```
      
      Now, the array is stored in a `unique_ptr` so that it's properly
      deallocated when the function returns, without needing the goto fail.
      4ceab25d
  2. Jan 18, 2017
  3. Jan 17, 2017
  4. May 13, 2016
  5. Feb 05, 2016
  6. Jan 23, 2016
  7. Jan 08, 2016
  8. Dec 27, 2015
  9. Jun 23, 2015
  10. Jun 22, 2015
  11. Jun 20, 2015
Loading