News for hackers. Stuff that matters.
Re:Android is a screwed, hard-coded, non-portable abomination. by rntz on Thursday November 05, 2009 @08:02PM (#925186)
That's fairly redundant.

    char *p;
    while (p = strchr(tmpfn, ' '))
        *p = '_';
Re:Android is a screwed, hard-coded, non-portable abomination. by tptacek on Friday November 06, 2009 @12:34AM (#925506)
I love that the O(n^2 / 2) algorithm for this problem is modded 4x the O(n) one.
Re:Android is a screwed, hard-coded, non-portable abomination. by jongraehl on Friday November 06, 2009 @02:10AM (#925623)
If you meant to be O(n), you should have used p=strchr(p,' ') for the next-iteration part of your for loop.
Re:Android is a screwed, hard-coded, non-portable abomination. by tptacek on Friday November 06, 2009 @02:16AM (#925627)
I didn't write that code, Google did. I wonder if the person who wrote it can figure out how many golf balls fit in a school bus?
Re:Android is a screwed, hard-coded, non-portable abomination. by tptacek on Thursday November 05, 2009 @08:20PM (#925214)
OW MY BRAIN.

  char *cp = NULL;
  for(cp = tmpfn; cp && *cp; cp++)
    if(isspace(*cp))
      *cp = '_';
Re:Android is a screwed, hard-coded, non-portable abomination. by jagjit on Thursday November 05, 2009 @09:57PM (#925339)
char cp = tmpfn; for(; cp; cp++) if(cp == ' ') cp = '_';

my brain too