Back to index

lightning-sunbird  0.9+nobinonly
Functions
affixmgr.cpp File Reference
#include "license.readme"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "affixmgr.hxx"
#include "affentry.hxx"

Go to the source code of this file.

Functions

void mychomp (char *s)
char * mystrdup (const char *s)
char * myrevstrdup (const char *s)
char * mystrsep (char **sptr, const char delim)
int isSubset (const char *s1, const char *s2)
int isRevSubset (const char *s1, const char *end_of_s2, int len_s2)

Function Documentation

int isRevSubset ( const char *  s1,
const char *  end_of_s2,
int  len_s2 
)

Definition at line 116 of file csutil.cpp.

{
  while( (len > 0) && *s1 && (*s1 == *end_of_s2) ) {
    s1++;
    end_of_s2--;
    len --;
  }
  return (*s1 == '\0');
}

Here is the caller graph for this function:

int isSubset ( const char *  s1,
const char *  s2 
)

Definition at line 105 of file csutil.cpp.

{
  while( *s1 && (*s1 == *s2) ) {
    s1++;
    s2++;
  }
  return (*s1 == '\0');
}

Here is the caller graph for this function:

void mychomp ( char *  s)

Definition at line 66 of file csutil.cpp.

{
  int k = strlen(s);
  if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
  if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
}

Here is the caller graph for this function:

char* myrevstrdup ( const char *  s)

Definition at line 75 of file csutil.cpp.

{
    char * d = NULL;
    if (s) {
       int sl = strlen(s);
       d = (char *) malloc((sl+1) * sizeof(char));
       if (d) {
        const char * p = s + sl - 1;
         char * q = d;
         while (p >= s) *q++ = *p--;
         *q = '\0';
       }
    }
    return d; 
}
char* mystrdup ( const char *  s)

Definition at line 53 of file csutil.cpp.

{
  char * d = NULL;
  if (s) {
     int sl = strlen(s);
     d = (char *) malloc(((sl+1) * sizeof(char)));
     if (d) memcpy(d,s,((sl+1)*sizeof(char)));
  }
  return d;
}
char* mystrsep ( char **  sptr,
const char  delim 
)

Definition at line 26 of file csutil.cpp.

{
  char * rv = NULL;
  char * mp = *stringp;
  int n = strlen(mp);
  if (n > 0) {
     char * dp = (char *)memchr(mp,(int)((unsigned char)delim),n);
     if (dp) {
        *stringp = dp+1;
        int nc = (int)((unsigned long)dp - (unsigned long)mp); 
        rv = (char *) malloc(nc+1);
        memcpy(rv,mp,nc);
        *(rv+nc) = '\0';
        return rv;
     } else {
       rv = (char *) malloc(n+1);
       memcpy(rv, mp, n);
       *(rv+n) = '\0';
       *stringp = mp + n;
       return rv;
     }
  }
  return NULL;
}

Here is the caller graph for this function: