comparison src/util.c @ 4282:aa20cc16dc08

[gaim-migrate @ 4533] Let's see here... I kinda rewrote normalize. I think it should be more efficient this way, because memory isn't allocated. I dunno. That function is called quite a bit, though. The ngettext thing is cool, but having parameters in the right order is cooler. :-) I made is so aliases on the server list overwrite the local aliases. They would only be the same if you sign on elsewhere and change them, so this should be ok. I renamed some variables in ssi.c. Time Warner is still a horrible, horrible company. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 10 Jan 2003 23:08:56 +0000
parents af2eeb7f7cf8
children 5978e3d53f29
comparison
equal deleted inserted replaced
4281:d956ac6157cd 4282:aa20cc16dc08
464 464
465 465
466 char *normalize(const char *s) 466 char *normalize(const char *s)
467 { 467 {
468 static char buf[BUF_LEN]; 468 static char buf[BUF_LEN];
469 char *t, *u; 469 int i, j;
470 int x = 0;
471 470
472 g_return_val_if_fail((s != NULL), NULL); 471 g_return_val_if_fail((s != NULL), NULL);
473 472
474 u = t = g_strdup(s); 473 strncpy(buf, s, BUF_LEN);
475 474 for (i=0, j=0; buf[j]; i++, j++) {
476 strcpy(t, s); 475 while (buf[j] == ' ')
477 g_strdown(t); 476 j++;
478 477 buf[i] = buf[j];
479 while (*t && (x < BUF_LEN - 1)) { 478 }
480 if (*t != ' ') { 479 buf[i] = '\0';
481 buf[x] = *t; 480 g_strdown(buf);
482 x++; 481
483 }
484 t++;
485 }
486 buf[x] = '\0';
487 g_free(u);
488 return buf; 482 return buf;
489 } 483 }
490 484
491 char *date() 485 char *date()
492 { 486 {