Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 25. október 2026

Rozdiely pre libplaton/platon/str/strdyn.c medzi verziami 1.19 a 1.20

verzia 1.19, 2002/08/16 20:31:43 verzia 1.20, 2002/08/27 13:12:33
Riadok 10 
Riadok 10 
 #include "strplus.h"  #include "strplus.h"
 #include "strdyn.h"  #include "strdyn.h"
   
 #ifndef FUNCTION  
 #  define FUNCTION_NAME(_unused, _name) _unused##_name  
 #  define FUNCTION(_name) FUNCTION_NAME(, ## _name)  
 #endif  
   
   
         void          void
 FUNCTION(strdyn_free)(ar)  PLATON_FUNC(strdyn_free)(ar)
         char **ar;          char **ar;
 {  {
         register int i;          register int i;
Riadok 29  FUNCTION(strdyn_free)(ar)
Riadok 23  FUNCTION(strdyn_free)(ar)
 }  }
   
         void          void
 FUNCTION(strdyn_safe_free)(ar)  PLATON_FUNC(strdyn_safe_free)(ar)
         char **ar;          char **ar;
 {  {
         if (ar == NULL)          if (ar == NULL)
                 return;                  return;
   
         FUNCTION(strdyn_free)(ar);          PLATON_FUNC(strdyn_free)(ar);
   
         return;          return;
 }  }
   
         int          int
 FUNCTION(strdyn_get_size)(ar)  PLATON_FUNC(strdyn_get_size)(ar)
         char **ar;          char **ar;
 {  {
         register int i;          register int i;
Riadok 53  FUNCTION(strdyn_get_size)(ar)
Riadok 47  FUNCTION(strdyn_get_size)(ar)
 }  }
   
         char **          char **
 FUNCTION(strdyn_create)(void)  PLATON_FUNC(strdyn_create)(void)
 {  {
         register char **ar;          register char **ar;
   
Riadok 66  FUNCTION(strdyn_create)(void)
Riadok 60  FUNCTION(strdyn_create)(void)
 }  }
   
 char **  char **
 FUNCTION(strdyn_create_va)(  PLATON_FUNC(strdyn_create_va)(
                 char *s1,                  char *s1,
                 ...)                  ...)
 {  {
         register char **ar;          register char **ar;
   
         if ((ar = FUNCTION(strdyn_create)()) == NULL)          if ((ar = PLATON_FUNC(strdyn_create)()) == NULL)
                 return NULL;                  return NULL;
   
         if (s1 != NULL) {          if (s1 != NULL) {
                 register char *s;                  register char *s;
                 va_list ap;                  va_list ap;
   
                 if ((ar = FUNCTION(strdyn_add)(ar, s1)) == NULL)                  if ((ar = PLATON_FUNC(strdyn_add)(ar, s1)) == NULL)
                         return NULL;                          return NULL;
   
                 va_start(ap, s1);                  va_start(ap, s1);
   
                 while ((s = va_arg(ap, char *)) != NULL)                  while ((s = va_arg(ap, char *)) != NULL)
                         if ((ar = FUNCTION(strdyn_add)(ar, s)) == NULL)                          if ((ar = PLATON_FUNC(strdyn_add)(ar, s)) == NULL)
                                 return NULL;                                  return NULL;
   
                 va_end(ap);                  va_end(ap);
Riadok 95  FUNCTION(strdyn_create_va)(
Riadok 89  FUNCTION(strdyn_create_va)(
 }  }
   
         char **          char **
 FUNCTION(strdyn_create_ar)(ar)  PLATON_FUNC(strdyn_create_ar)(ar)
         char **ar;          char **ar;
 {  {
         register int i;          register int i;
         register char **new_ar;          register char **new_ar;
   
         if ((new_ar = (char**) malloc((FUNCTION(strdyn_get_size)(ar) + 1)          if ((new_ar = (char**) malloc((PLATON_FUNC(strdyn_get_size)(ar) + 1)
                                         * sizeof(char*))) == NULL)                                          * sizeof(char*))) == NULL)
                         return NULL;                          return NULL;
   
Riadok 114  FUNCTION(strdyn_create_ar)(ar)
Riadok 108  FUNCTION(strdyn_create_ar)(ar)
 }  }
   
 char **  char **
 FUNCTION(strdyn_safe_create_ar)(ar)  PLATON_FUNC(strdyn_safe_create_ar)(ar)
         char **ar;          char **ar;
 {  {
         if (ar == NULL)          if (ar == NULL)
                 return NULL;                  return NULL;
   
         return FUNCTION(strdyn_create_ar)(ar);          return PLATON_FUNC(strdyn_create_ar)(ar);
 }  }
   
 char **  char **
 FUNCTION(strdyn_add)(ar, s)  PLATON_FUNC(strdyn_add)(ar, s)
         char       **ar;          char       **ar;
         const char *s;          const char *s;
 {  {
         register int count;          register int count;
   
         if (ar == NULL)          if (ar == NULL)
                 if ((ar = FUNCTION(strdyn_create)()) == NULL)                  if ((ar = PLATON_FUNC(strdyn_create)()) == NULL)
                         return NULL;                          return NULL;
   
         count = FUNCTION(strdyn_get_size)(ar);          count = PLATON_FUNC(strdyn_get_size)(ar);
   
         if ((ar = (char **) realloc(ar, (count + 2) * sizeof(char *))) == NULL)          if ((ar = (char **) realloc(ar, (count + 2) * sizeof(char *))) == NULL)
                 return NULL;                  return NULL;
Riadok 146  FUNCTION(strdyn_add)(ar, s)
Riadok 140  FUNCTION(strdyn_add)(ar, s)
 }  }
   
 char **  char **
 FUNCTION(strdyn_add_va)(  PLATON_FUNC(strdyn_add_va)(
                 char **ar,                  char **ar,
                 ...)                  ...)
 {  {
Riadok 154  FUNCTION(strdyn_add_va)(
Riadok 148  FUNCTION(strdyn_add_va)(
         va_list ap;          va_list ap;
   
         if (ar == NULL)          if (ar == NULL)
                 if ((ar = FUNCTION(strdyn_create)()) == NULL)                  if ((ar = PLATON_FUNC(strdyn_create)()) == NULL)
                         return NULL;                          return NULL;
   
         va_start(ap, ar);          va_start(ap, ar);
   
         while ((s = va_arg(ap, char *)) != NULL)          while ((s = va_arg(ap, char *)) != NULL)
                 if ((ar = FUNCTION(strdyn_add)(ar, s)) == NULL)                  if ((ar = PLATON_FUNC(strdyn_add)(ar, s)) == NULL)
                         return NULL;                          return NULL;
   
         va_end(ap);          va_end(ap);
Riadok 169  FUNCTION(strdyn_add_va)(
Riadok 163  FUNCTION(strdyn_add_va)(
 }  }
   
 char **  char **
 FUNCTION(strdyn_add_ar)(ar, s_ar)  PLATON_FUNC(strdyn_add_ar)(ar, s_ar)
         char         **ar;          char         **ar;
         char * const *s_ar;          char * const *s_ar;
 {  {
         register int k;          register int k;
   
         for (k = 0; s_ar[k] != NULL; k++)          for (k = 0; s_ar[k] != NULL; k++)
                 if ((ar = FUNCTION(strdyn_add)(ar, s_ar[k])) == NULL)                  if ((ar = PLATON_FUNC(strdyn_add)(ar, s_ar[k])) == NULL)
                         return NULL;                          return NULL;
   
         return ar;          return ar;
 }  }
   
 char **  char **
 FUNCTION(strdyn_remove_idx)(ar, idx)  PLATON_FUNC(strdyn_remove_idx)(ar, idx)
         char **ar;          char **ar;
         int  idx;          int  idx;
 {  {
Riadok 204  FUNCTION(strdyn_remove_idx)(ar, idx)
Riadok 198  FUNCTION(strdyn_remove_idx)(ar, idx)
 }  }
   
 char **  char **
 FUNCTION(strdyn_remove_str)(ar, s)  PLATON_FUNC(strdyn_remove_str)(ar, s)
         char **ar;          char **ar;
         char *s;          char *s;
 {  {
         register int idx;          register int idx;
   
         idx = FUNCTION(strdyn_search)(ar, s);          idx = PLATON_FUNC(strdyn_search)(ar, s);
   
         if (idx < 0)          if (idx < 0)
                 return ar;                  return ar;
   
         return FUNCTION(strdyn_remove_idx)(ar, idx);          return PLATON_FUNC(strdyn_remove_idx)(ar, idx);
 }  }
   
 char **  char **
 FUNCTION(strdyn_remove_str_all)(ar, s)  PLATON_FUNC(strdyn_remove_str_all)(ar, s)
         char **ar;          char **ar;
         char *s;          char *s;
 {  {
Riadok 229  FUNCTION(strdyn_remove_str_all)(ar, s)
Riadok 223  FUNCTION(strdyn_remove_str_all)(ar, s)
                 if (new_ar != NULL)                  if (new_ar != NULL)
                         ar = new_ar;                          ar = new_ar;
   
                 if ((new_ar = FUNCTION(strdyn_remove_str)(ar, s)) == NULL)                  if ((new_ar = PLATON_FUNC(strdyn_remove_str)(ar, s)) == NULL)
                         return NULL;                          return NULL;
         }          }
   
Riadok 237  FUNCTION(strdyn_remove_str_all)(ar, s)
Riadok 231  FUNCTION(strdyn_remove_str_all)(ar, s)
 }  }
   
 char **  char **
 FUNCTION(strdyn_remove_empty)(ar)  PLATON_FUNC(strdyn_remove_empty)(ar)
         char **ar;          char **ar;
 {  {
         register int i, j;          register int i, j;
Riadok 261  FUNCTION(strdyn_remove_empty)(ar)
Riadok 255  FUNCTION(strdyn_remove_empty)(ar)
 }  }
   
 char **  char **
 FUNCTION(strdyn_remove_all)(ar)  PLATON_FUNC(strdyn_remove_all)(ar)
         char **ar;          char **ar;
 {  {
         register int i;          register int i;
Riadok 278  FUNCTION(strdyn_remove_all)(ar)
Riadok 272  FUNCTION(strdyn_remove_all)(ar)
 }  }
   
 char **  char **
 FUNCTION(strdyn_explode_chr)(str, sep)  PLATON_FUNC(strdyn_explode_chr)(str, sep)
         char *str;          char *str;
         int sep;          int sep;
 {  {
Riadok 287  FUNCTION(strdyn_explode_chr)(str, sep)
Riadok 281  FUNCTION(strdyn_explode_chr)(str, sep)
         sep_str[0] = (char) sep;          sep_str[0] = (char) sep;
         sep_str[1] = '\0';          sep_str[1] = '\0';
   
         return FUNCTION(strdyn_explode_str)(str, sep_str);          return PLATON_FUNC(strdyn_explode_str)(str, sep_str);
 }  }
   
 char **  char **
 FUNCTION(strdyn_explode2_chr)(str, sep)  PLATON_FUNC(strdyn_explode2_chr)(str, sep)
         char *str;          char *str;
         int sep;          int sep;
 {  {
   
         return FUNCTION(strdyn_remove_empty)(FUNCTION(strdyn_explode_chr)(str, sep));          return PLATON_FUNC(strdyn_remove_empty)(PLATON_FUNC(strdyn_explode_chr)(str, sep));
 }  }
   
 char **  char **
 FUNCTION(strdyn_explode_str)(str, sep)  PLATON_FUNC(strdyn_explode_str)(str, sep)
         char *str;          char *str;
         char *sep;          char *sep;
 {  {
Riadok 311  FUNCTION(strdyn_explode_str)(str, sep)
Riadok 305  FUNCTION(strdyn_explode_str)(str, sep)
         if (str == NULL || sep == NULL)          if (str == NULL || sep == NULL)
                 return NULL;                  return NULL;
   
         ar_size = FUNCTION(strcnt_sepstr)(str, sep);          ar_size = PLATON_FUNC(strcnt_sepstr)(str, sep);
   
         if ((ar = (char**) malloc((ar_size + 2) * sizeof(char*))) == NULL)          if ((ar = (char**) malloc((ar_size + 2) * sizeof(char*))) == NULL)
                 return NULL;                  return NULL;
Riadok 339  FUNCTION(strdyn_explode_str)(str, sep)
Riadok 333  FUNCTION(strdyn_explode_str)(str, sep)
 }  }
   
 char **  char **
 FUNCTION(strdyn_explode2_str)(str, sep)  PLATON_FUNC(strdyn_explode2_str)(str, sep)
         char *str;          char *str;
         char *sep;          char *sep;
 {  {
         return FUNCTION(strdyn_remove_empty)(FUNCTION(strdyn_explode_str)(str, sep));          return PLATON_FUNC(strdyn_remove_empty)(PLATON_FUNC(strdyn_explode_str)(str, sep));
 }  }
   
 char **  char **
 FUNCTION(strdyn_explode_ar)(str, sep)  PLATON_FUNC(strdyn_explode_ar)(str, sep)
         char *str;          char *str;
         char **sep;          char **sep;
 {  {
Riadok 356  FUNCTION(strdyn_explode_ar)(str, sep)
Riadok 350  FUNCTION(strdyn_explode_ar)(str, sep)
   
         char **ar, **ar1;          char **ar, **ar1;
   
         if ((ar1 = FUNCTION(strdyn_explode_str)(str, sep[0])) == NULL)          if ((ar1 = PLATON_FUNC(strdyn_explode_str)(str, sep[0])) == NULL)
                 return NULL;                  return NULL;
   
         if (sep[1] != NULL) {          if (sep[1] != NULL) {
                 char **ar2;                  char **ar2;
                 register int i;                  register int i;
   
                 if ((ar = FUNCTION(strdyn_create)()) == NULL) {                  if ((ar = PLATON_FUNC(strdyn_create)()) == NULL) {
                         FUNCTION(strdyn_free)(ar1);                          PLATON_FUNC(strdyn_free)(ar1);
                         return NULL;                          return NULL;
                 }                  }
   
                 for (i = 0; i < strdyn_count(ar1); i++) {                  for (i = 0; i < strdyn_count(ar1); i++) {
                         if ((ar2 = FUNCTION(strdyn_explode_ar)(ar1[i], sep + 1)) == NULL) {                          if ((ar2 = PLATON_FUNC(strdyn_explode_ar)(ar1[i], sep + 1)) == NULL) {
                                 FUNCTION(strdyn_free)(ar1);                                  PLATON_FUNC(strdyn_free)(ar1);
                                 FUNCTION(strdyn_free)(ar);                                  PLATON_FUNC(strdyn_free)(ar);
                                 return NULL;                                  return NULL;
                         }                          }
   
                         if ((ar = FUNCTION(strdyn_add_ar)(ar, ar2)) == NULL) {                          if ((ar = PLATON_FUNC(strdyn_add_ar)(ar, ar2)) == NULL) {
                                 FUNCTION(strdyn_free)(ar1);                                  PLATON_FUNC(strdyn_free)(ar1);
                                 FUNCTION(strdyn_free)(ar);                                  PLATON_FUNC(strdyn_free)(ar);
                                 FUNCTION(strdyn_free)(ar2);                                  PLATON_FUNC(strdyn_free)(ar2);
                                 return NULL;                                  return NULL;
                         }                          }
   
                         FUNCTION(strdyn_free)(ar2);                          PLATON_FUNC(strdyn_free)(ar2);
                 }                  }
   
                 FUNCTION(strdyn_free)(ar1);                  PLATON_FUNC(strdyn_free)(ar1);
         }          }
         else          else
                 ar = ar1;                  ar = ar1;
Riadok 394  FUNCTION(strdyn_explode_ar)(str, sep)
Riadok 388  FUNCTION(strdyn_explode_ar)(str, sep)
 }  }
   
 char **  char **
 FUNCTION(strdyn_explode2_ar)(str, sep)  PLATON_FUNC(strdyn_explode2_ar)(str, sep)
         char *str;          char *str;
         char **sep;          char **sep;
 {  {
         return FUNCTION(strdyn_remove_empty)(FUNCTION(strdyn_explode_ar)(str, sep));          return PLATON_FUNC(strdyn_remove_empty)(PLATON_FUNC(strdyn_explode_ar)(str, sep));
 }  }
   
 char *  char *
 FUNCTION(strdyn_implode_chr)(ar, sep)  PLATON_FUNC(strdyn_implode_chr)(ar, sep)
         char **ar;          char **ar;
         int sep;          int sep;
 {  {
Riadok 411  FUNCTION(strdyn_implode_chr)(ar, sep)
Riadok 405  FUNCTION(strdyn_implode_chr)(ar, sep)
         sep_str[0] = (char) sep;          sep_str[0] = (char) sep;
         sep_str[1] = '\0';          sep_str[1] = '\0';
   
         return FUNCTION(strdyn_implode_str)(ar, sep_str);          return PLATON_FUNC(strdyn_implode_str)(ar, sep_str);
 }  }
   
 char *  char *
 FUNCTION(strdyn_implode2_chr)(ar, sep)  PLATON_FUNC(strdyn_implode2_chr)(ar, sep)
         char **ar;          char **ar;
         int sep;          int sep;
 {  {
         register char **new_ar;          register char **new_ar;
         register char *s;          register char *s;
   
         new_ar = FUNCTION(strdyn_remove_empty)(strdyn_duplicate(ar));          new_ar = PLATON_FUNC(strdyn_remove_empty)(strdyn_duplicate(ar));
   
         s = FUNCTION(strdyn_implode_chr)(new_ar, sep);          s = PLATON_FUNC(strdyn_implode_chr)(new_ar, sep);
   
         FUNCTION(strdyn_free)(new_ar);          PLATON_FUNC(strdyn_free)(new_ar);
   
         return s;          return s;
 }  }
   
 char *  char *
 FUNCTION(strdyn_implode_str)(ar, sep)  PLATON_FUNC(strdyn_implode_str)(ar, sep)
         char **ar;          char **ar;
         char *sep;          char *sep;
 {  {
Riadok 462  FUNCTION(strdyn_implode_str)(ar, sep)
Riadok 456  FUNCTION(strdyn_implode_str)(ar, sep)
 }  }
   
 char *  char *
 FUNCTION(strdyn_implode2_str)(ar, str)  PLATON_FUNC(strdyn_implode2_str)(ar, str)
         char **ar;          char **ar;
         char *str;          char *str;
 {  {
         register char **new_ar;          register char **new_ar;
         register char *s;          register char *s;
   
         new_ar = FUNCTION(strdyn_remove_empty)(strdyn_duplicate(ar));          new_ar = PLATON_FUNC(strdyn_remove_empty)(strdyn_duplicate(ar));
   
         s = FUNCTION(strdyn_implode_str)(new_ar, str);          s = PLATON_FUNC(strdyn_implode_str)(new_ar, str);
   
         FUNCTION(strdyn_free)(new_ar);          PLATON_FUNC(strdyn_free)(new_ar);
   
         return s;          return s;
 }  }
   
 char **  char **
 FUNCTION(strdyn_conjunct)(ar1, ar2)  PLATON_FUNC(strdyn_conjunct)(ar1, ar2)
         char **ar1;          char **ar1;
         char **ar2;          char **ar2;
 {  {
         register int i;          register int i;
         register char **ar;          register char **ar;
   
         if ((ar = FUNCTION(strdyn_create)()) == NULL)          if ((ar = PLATON_FUNC(strdyn_create)()) == NULL)
                 return NULL;                  return NULL;
   
         for (i = 0; ar2[i] != NULL; i++) {          for (i = 0; ar2[i] != NULL; i++) {
                 if (! FUNCTION(strdyn_compare)(ar1, ar2[i])) {                  if (! PLATON_FUNC(strdyn_compare)(ar1, ar2[i])) {
                         if ((ar = FUNCTION(strdyn_add)(ar, ar2[i])) == NULL)                          if ((ar = PLATON_FUNC(strdyn_add)(ar, ar2[i])) == NULL)
                                 return NULL;                                  return NULL;
                 }                  }
         }          }
Riadok 500  FUNCTION(strdyn_conjunct)(ar1, ar2)
Riadok 494  FUNCTION(strdyn_conjunct)(ar1, ar2)
 }  }
   
 char **  char **
 FUNCTION(strdyn_consolide)(ar1, ar2)  PLATON_FUNC(strdyn_consolide)(ar1, ar2)
         char **ar1;          char **ar1;
         char **ar2;          char **ar2;
 {  {
         register int i;          register int i;
         register char **ar;          register char **ar;
   
         if ((ar = FUNCTION(strdyn_create)()) == NULL)          if ((ar = PLATON_FUNC(strdyn_create)()) == NULL)
                 return NULL;                  return NULL;
   
         for (i = 0; ar1[i] != NULL; i++) {          for (i = 0; ar1[i] != NULL; i++) {
                 if (FUNCTION(strdyn_compare)(ar, ar1[i])) {                  if (PLATON_FUNC(strdyn_compare)(ar, ar1[i])) {
                         if ((ar = FUNCTION(strdyn_add)(ar, ar1[i])) == NULL)                          if ((ar = PLATON_FUNC(strdyn_add)(ar, ar1[i])) == NULL)
                                 return NULL;                                  return NULL;
                 }                  }
         }          }
   
         for (i = 0; ar2[i] != NULL; i++) {          for (i = 0; ar2[i] != NULL; i++) {
                 if (FUNCTION(strdyn_compare)(ar, ar2[i])) {                  if (PLATON_FUNC(strdyn_compare)(ar, ar2[i])) {
                         if ((ar = FUNCTION(strdyn_add)(ar, ar2[i])) == NULL)                          if ((ar = PLATON_FUNC(strdyn_add)(ar, ar2[i])) == NULL)
                                 return NULL;                                  return NULL;
                 }                  }
         }          }
Riadok 528  FUNCTION(strdyn_consolide)(ar1, ar2)
Riadok 522  FUNCTION(strdyn_consolide)(ar1, ar2)
 }  }
   
 int  int
 FUNCTION(strdyn_search)(ar, s)  PLATON_FUNC(strdyn_search)(ar, s)
         char **ar;          char **ar;
         char *s;          char *s;
 {  {
Riadok 542  FUNCTION(strdyn_search)(ar, s)
Riadok 536  FUNCTION(strdyn_search)(ar, s)
 }  }
   
 int  int
 FUNCTION(strdyn_casesearch)(ar, s)  PLATON_FUNC(strdyn_casesearch)(ar, s)
         char **ar;          char **ar;
         char *s;          char *s;
 {  {
Riadok 556  FUNCTION(strdyn_casesearch)(ar, s)
Riadok 550  FUNCTION(strdyn_casesearch)(ar, s)
 }  }
   
 int  int
 FUNCTION(strdyn_compare)(ar, s)  PLATON_FUNC(strdyn_compare)(ar, s)
         char **ar;          char **ar;
         char *s;          char *s;
 {  {
         return FUNCTION(strdyn_search)(ar, s) < 0 ? -1 : 0;          return PLATON_FUNC(strdyn_search)(ar, s) < 0 ? -1 : 0;
 }  }
   
 int  int
 FUNCTION(strdyn_casecompare)(ar, s)  PLATON_FUNC(strdyn_casecompare)(ar, s)
         char **ar;          char **ar;
         char *s;          char *s;
 {  {
         return FUNCTION(strdyn_casesearch)(ar, s) < 0 ? -1 : 0;          return PLATON_FUNC(strdyn_casesearch)(ar, s) < 0 ? -1 : 0;
         return FUNCTION(strdyn_casesearch)(ar, s) < 0 ? -1 : 0;          return PLATON_FUNC(strdyn_casesearch)(ar, s) < 0 ? -1 : 0;
 }  }
   
 int  int
 FUNCTION(strdyn_compare_all)(ar, s)  PLATON_FUNC(strdyn_compare_all)(ar, s)
         char **ar;          char **ar;
         char *s;          char *s;
 {  {
Riadok 587  FUNCTION(strdyn_compare_all)(ar, s)
Riadok 581  FUNCTION(strdyn_compare_all)(ar, s)
 }  }
   
 char *  char *
 FUNCTION(strdyn_str2)(s, ar, idx)  PLATON_FUNC(strdyn_str2)(s, ar, idx)
         char *s;          char *s;
         char **ar;          char **ar;
         int  *idx;          int  *idx;

Legend:
Odstranené z verzie1.19  
zmenené riadky
  Pridané vo verzii1.20

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok