View | Details | Raw Unified | Return to issue 23535
Collapse All | Expand All

(-)lingucomponent/source/thesaurus/mythes/mythes.cxx (-23 / +2 lines)
Lines 8-26 Link Here
8
8
9
// some basic utility routines
9
// some basic utility routines
10
10
11
// string duplication routine
11
extern void mychomp(char * s);
12
char * mystrdup(const char * p)
12
extern char * mystrdup(const char * s); 
13
{
14
   
15
  int sl = strlen(p) + 1;
16
  char * d = (char *)malloc(sl);
17
  if (d) {
18
    memcpy(d,p,sl);
19
    return d;
20
  }
21
  return NULL;
22
}
23
24
13
25
// return index of char in string
14
// return index of char in string
26
int mystr_indexOfChar(const char * d, int c)
15
int mystr_indexOfChar(const char * d, int c)
Lines 29-44 Link Here
29
  if (p) return (int)(p-d);
18
  if (p) return (int)(p-d);
30
  return -1;
19
  return -1;
31
}
20
}
32
33
34
// remove cross-platform text line end characters
35
void mychomp(char * s)
36
{
37
  int k = strlen(s);
38
  if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
39
  if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
40
}
41
42
21
43
MyThes::MyThes(const char* idxpath, const char * datpath)
22
MyThes::MyThes(const char* idxpath, const char * datpath)
44
{
23
{

Return to issue 23535