The build of aelparse was still broken in some cases, so instead of having to

keep figuring out workarounds for build issues on various platforms, just go
ahead and remove what started all of this.  Two instances of ast_calloc have
been changed to calloc in pbx/ael/ael.y.

ast_copy_string isn't actually needed here because the only place it is used is
in ast_expr2f.c.  However, the utils Makefile already builds its own
ast_expr2f.o with -DSTANDALONE, which makes it use strncpy instead of
ast_copy_string.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@24115 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant 2006-05-02 03:03:27 +00:00
parent 6e24fb7a37
commit 34e0ae0e6a
4 changed files with 264 additions and 314 deletions

File diff suppressed because it is too large Load Diff

View File

@ -115,7 +115,7 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 49 "ael.y"
#line 48 "ael.y"
typedef union YYSTYPE {
int intval; /* integer value, typically flags */
char *str; /* strings */

View File

@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
#include "asterisk/logger.h"
#include "asterisk/utils.h" /* ast_calloc() */
#include "asterisk/ael_structs.h"
static pval * linku1(pval *head, pval *tail);
@ -449,7 +448,7 @@ statement : LC statements RC {
tot++; /* for a sep like a comma */
}
tot+=4; /* for safety */
bufx = ast_calloc(1, tot);
bufx = calloc(1, tot);
strcpy(bufx,$1->u1.str);
strcat(bufx,"(");
/* XXX need to advance the pointer or the loop is very inefficient */
@ -844,7 +843,7 @@ static char *ael_token_subst(char *mess)
}
len++;
}
res = ast_calloc(1, len+1);
res = calloc(1, len+1);
res[0] = 0;
s = res;
for (p=mess; *p;) {
@ -884,7 +883,7 @@ static struct pval *npval(pvaltype type, int first_line, int last_line,
int first_column, int last_column)
{
extern char *my_file;
pval *z = ast_calloc(1, sizeof(struct pval));
pval *z = calloc(1, sizeof(struct pval));
z->type = type;
z->startline = first_line;
z->endline = last_line;

View File

@ -11,14 +11,6 @@
#include <regex.h>
#include <limits.h>
/* ast_copy_string */
#define AST_API_MODULE
#include "asterisk/strings.h"
/* ensure that _ast_calloc works */
#define AST_API_MODULE
#include "asterisk/utils.h"
#include "asterisk/ast_expr.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
@ -57,7 +49,6 @@ struct ast_app *pbx_findapp(const char *app);
static int no_comp = 0;
static int use_curr_dir = 0;
struct ast_app *pbx_findapp(const char *app)
{
return (struct ast_app*)1; /* so as not to trigger an error */
@ -258,42 +249,3 @@ int main(int argc, char **argv)
return 0;
}
/*
* XXX the code below is replicated here from utils.c, because
* the #define AST_API_MODULE references functions that are
* not available on all platforms.
* We hit the problem with strndup (which in turn uses strnlen),
* but it is possible that there are more of these issues.
*
* When utils.c is properly split and functions become available
* through a library, this file will just link to the library and
* the problem will go away together with the code below.
*/
#ifndef HAVE_STRNLEN
size_t strnlen(const char *s, size_t n)
{
size_t len;
for (len=0; len < n; len++)
if (s[len] == '\0')
break;
return len;
}
#endif /* !HAVE_STRNLEN */
#if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
char *strndup(const char *s, size_t n)
{
size_t len = strnlen(s, n);
char *new = malloc(len + 1);
if (!new)
return NULL;
new[len] = '\0';
return memcpy(new, s, len);
}
#endif /* !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC) */