_info 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include "config.h"
  4. /**
  5. * likely - macros for annotating likely/unlikely branches in the code
  6. *
  7. * Inspired by Andi Kleen's macros for the Linux Kernel, these macros
  8. * help you annotate rare paths in your code for the convenience of the
  9. * compiler and the reader.
  10. *
  11. * License: LGPL (2 or any later version)
  12. * Author: Rusty Russell <rusty@rustcorp.com.au>
  13. *
  14. * Example:
  15. * #include <ccan/likely/likely.h>
  16. * #include <stdio.h>
  17. *
  18. * int main(int argc, char *argv[])
  19. * {
  20. * // This example is silly: the compiler knows exit() is unlikely.
  21. * if (unlikely(argc == 1)) {
  22. * fprintf(stderr, "Usage: %s <args>...\n", argv[0]);
  23. * return 1;
  24. * }
  25. * for (argc++; argv[argc]; argc++)
  26. * printf("%s\n", argv[argc]);
  27. * return 0;
  28. * }
  29. */
  30. int main(int argc, char *argv[])
  31. {
  32. /* Expect exactly one argument */
  33. if (argc != 2)
  34. return 1;
  35. if (strcmp(argv[1], "depends") == 0) {
  36. printf("ccan/str\n");
  37. printf("ccan/hashtable\n");
  38. printf("ccan/hash\n");
  39. return 0;
  40. }
  41. return 1;
  42. }