coverity_model.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Coverity Scan model
  2. *
  3. * This is a modelling file for Coverity Scan. Modelling helps to avoid false
  4. * positives.
  5. *
  6. * - A model file can't import any header files.
  7. * - Therefore only some built-in primitives like int, char and void are
  8. * available but not NULL etc.
  9. * - Modelling doesn't need full structs and typedefs. Rudimentary structs
  10. * and similar types are sufficient.
  11. * - An uninitialised local pointer is not an error. It signifies that the
  12. * variable could be either NULL or have some data.
  13. *
  14. * Coverity Scan doesn't pick up modifications automatically. The model file
  15. * must be uploaded by an admin in the analysis.
  16. *
  17. * Based on:
  18. * http://hg.python.org/cpython/file/tip/Misc/coverity_model.c
  19. * Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
  20. * 2011, 2012, 2013 Python Software Foundation; All Rights Reserved
  21. *
  22. */
  23. /*
  24. * Useful references:
  25. * https://scan.coverity.com/models
  26. */
  27. typedef unsigned int switch_status_t;
  28. struct pthread_mutex_t {};
  29. struct switch_mutex
  30. {
  31. struct pthread_mutex_t lock;
  32. };
  33. typedef struct switch_mutex switch_mutex_t;
  34. switch_status_t switch_mutex_lock(switch_mutex_t *lock)
  35. {
  36. __coverity_recursive_lock_acquire__(&lock->lock);
  37. }
  38. switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
  39. {
  40. __coverity_recursive_lock_release__(&lock->lock);
  41. }