aboutsummaryrefslogtreecommitdiffstats
path: root/script/rails-post-deploy
diff options
context:
space:
mode:
Diffstat (limited to 'script/rails-post-deploy')
0 files changed, 0 insertions, 0 deletions
">** vector) { char **v; for(v = vector; *v; v++) { FREE(*v); } FREE(vector); } char ** y_strsplit(char * str, char * sep, int nelem) { char ** vector; char *s, *p; int i=0; int l = strlen(sep); if(nelem < 0) { char * s; nelem=0; for(s=strstr(str, sep); s; s=strstr(s+l, sep),nelem++) ; if(strcmp(str+strlen(str)-l, sep)) nelem++; } vector = y_new(char *, nelem + 1); for(p=str, s=strstr(p,sep); i<nelem && s; p=s+l, s=strstr(p,sep), i++) { int len = s-p; vector[i] = y_new(char, len+1); strncpy(vector[i], p, len); vector[i][len] = '\0'; } if(i<nelem) /* str didn't end with sep */ vector[i++] = strdup(p); vector[i] = NULL; return vector; } void * y_memdup(const void * addr, int n) { void * new_chunk = malloc(n); if(new_chunk) memcpy(new_chunk, addr, n); return new_chunk; } #endif