fc-lang.patch 793 B

123456789101112131415161718192021222324252627282930313233
  1. --- fontconfig-2.4.2/fc-lang/fc-lang.orig.c 2007-02-03 13:39:49.000000000 -0700
  2. +++ fontconfig-2.4.2/fc-lang/fc-lang.c 2007-02-03 13:46:08.000000000 -0700
  3. @@ -116,6 +116,20 @@
  4. return f;
  5. }
  6. +char* trim(char *s)
  7. +{
  8. + int len = strlen(s);
  9. +
  10. + /* nuke trailing whitespace */
  11. + while (len > 0 && (isspace(s[len - 1]) || s[len - 1]=='\n'))
  12. + s[--len] = '\0';
  13. +
  14. + /* skip leading whitespace */
  15. + s += strspn(s, " \n\r\t\v");
  16. +
  17. + return s;
  18. +}
  19. +
  20. /*
  21. * build a single charset from a source file
  22. *
  23. @@ -142,8 +156,7 @@
  24. if (!file)
  25. fatal (line, lineno,
  26. "invalid syntax, expected: include filename");
  27. - while (isspace(*file))
  28. - file++;
  29. + file = trim(file);
  30. f = scanopen (file);
  31. if (!f)
  32. fatal (file, 0, "can't open");