deps/kb_meme/meme-5.0.1/src/alph-in.c
/*
 * sort_and_remove_duplicates
 * Ensure symbols are sorted and there are no duplicates.
 */
sort_and_remove_duplicates
Ensure symbols are sorted and there are no duplicates.
sort_and_remove_duplicates Ensure symbols are sorted and there are no duplicates .
static bool sort_and_remove_duplicates(char *syms) {
  int nsyms;
  char *a, *b;
  bool duplicate;
  nsyms = strlen(syms);
  if (nsyms <= 1) return false;
  qsort(syms, nsyms, sizeof(char), alph_sym_cmp);
  duplicate = false;
  a = syms;
  b = syms+1;
  while (*b != '\0') {
    if (*a != *b) {
      a++;
      *a = *b;
      b++;
    } else {
      duplicate = true;
      b++;
    }
  }
  a++;
  *a = '\0';
  return duplicate;
}
static bool sort_and_remove_duplicates ( char * syms ) { int nsyms ; char * a , * b ; bool duplicate ; nsyms = strlen ( syms ) ; if ( nsyms <= 1 ) return false ; qsort ( syms , nsyms , sizeof ( char ) , alph_sym_cmp ) ; duplicate = false ; a = syms ; b = syms + 1 ; while ( * b != ' \0 ' ) { if ( * a != * b ) { a ++ ; * a = * b ; b ++ ; } else { duplicate = true ; b ++ ; } } a ++ ; * a = ' \0 ' ; return duplicate ; }
sort_and_remove_duplicates
 Ensure symbols are sorted and there are no duplicates.
sort_and_remove_duplicates Ensure symbols are sorted and there are no duplicates .