patch-cmn_utils_h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. $OpenBSD: patch-cmn_utils_h,v 1.1 2017/05/02 23:26:32 espie Exp $
  2. If you're going to wrap C++ functions, you need both const correct wrappers.
  3. Index: cmn/utils.h
  4. --- cmn/utils.h.orig
  5. +++ cmn/utils.h
  6. @@ -237,13 +237,22 @@ class Utils {
  7. /* EFFECTS: Wrapper for C library strcmp(). Return 0 if strings are the
  8. same. */
  9. - static char* strchr(const char* cs,int c)
  10. + static const char* strchr(const char* cs,int c)
  11. {return ::strchr(cs,c);}
  12. - static char* strrchr(const char* cs,int c)
  13. + static const char* strrchr(const char* cs,int c)
  14. {return ::strrchr(cs,c);}
  15. - static char* strstr(const char* cs,const char* ct)
  16. + static const char* strstr(const char* cs,const char* ct)
  17. + {return ::strstr(cs,ct);}
  18. +
  19. + static char* strchr(char* cs,int c)
  20. + {return ::strchr(cs,c);}
  21. +
  22. + static char* strrchr(char* cs,int c)
  23. + {return ::strrchr(cs,c);}
  24. +
  25. + static char* strstr(char* cs,const char* ct)
  26. {return ::strstr(cs,ct);}
  27. static void strcpy(char* s,const char* ct)