trace.h 768 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Squeezelite for esp32
  3. *
  4. * (c) Sebastien 2019
  5. * Philippe G. 2019, philippe_44@outlook.com
  6. *
  7. * This software is released under the MIT License.
  8. * https://opensource.org/licenses/MIT
  9. *
  10. */
  11. #pragma once
  12. #ifndef QUOTE
  13. #define QUOTE(name) #name
  14. #endif
  15. #ifndef STR
  16. #define STR(macro) QUOTE(macro)
  17. #endif
  18. #define ESP_LOG_DEBUG_EVENT(tag,e) ESP_LOGD(tag,"evt: " e)
  19. #ifndef STR_OR_ALT
  20. #define STR_OR_ALT(str,alt) (str?str:alt)
  21. #endif
  22. extern const char unknown_string_placeholder[];
  23. extern const char * str_or_unknown(const char * str);
  24. extern const char * str_or_null(const char * str);
  25. #ifndef FREE_AND_NULL
  26. #define FREE_AND_NULL(x) if(x) { free(x); x=NULL; }
  27. #endif
  28. #ifndef CASE_TO_STR
  29. #define CASE_TO_STR(x) case x: return STR(x); break;
  30. #endif