Changeset c894c15


Ignore:
Timestamp:
Feb 11, 2009, 12:20:21 PM (11 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
99b50a5
Parents:
a0e6082
git-author:
Nelson Elhage <nelhage@mit.edu> (02/10/09 18:43:23)
git-committer:
Nelson Elhage <nelhage@mit.edu> (02/11/09 12:20:21)
Message:
owl_function_zpunt: Replace sprintf with owl_sprintf
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    ra0e6082 rc894c15  
    28442844void owl_function_zpunt(char *class, char *inst, char *recip, int direction)
    28452845{
    2846   char *buff;
     2846  char *puntexpr, *classexpr, *instexpr, *recipexpr;
    28472847  char *quoted;
    28482848
    2849   buff=owl_malloc(strlen(class)+strlen(inst)+strlen(recip)+100);
    2850   strcpy(buff, "class");
    28512849  if (!strcmp(class, "*")) {
    2852     strcat(buff, " .*");
     2850    classexpr = owl_sprintf("class .*");
    28532851  } else {
    28542852    quoted=owl_text_quote(class, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     
    28562854    owl_text_tr(quoted, '\'', '.');
    28572855    owl_text_tr(quoted, '"', '.');
    2858     sprintf(buff + strlen(buff), " ^(un)*%s(\\.d)*$", quoted);
     2856    classexpr = owl_sprintf("class ^(un)*%s(\\.d)*$", quoted);
    28592857    owl_free(quoted);
    28602858  }
    28612859  if (!strcmp(inst, "*")) {
    2862     strcat(buff, " and instance .*");
     2860    instexpr = owl_sprintf(" and instance .*");
    28632861  } else {
    28642862    quoted=owl_text_quote(inst, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     
    28662864    owl_text_tr(quoted, '\'', '.');
    28672865    owl_text_tr(quoted, '"', '.');
    2868     sprintf(buff + strlen(buff), " and instance ^(un)*%s(\\.d)*$", quoted);
     2866    instexpr = owl_sprintf(" and instance ^(un)*%s(\\.d)*$", quoted);
    28692867    owl_free(quoted);
    28702868  }
    2871   if (strcmp(recip, "*")) {
     2869  if (!strcmp(recip, "*")) {
     2870    recipexpr = owl_sprintf("");
     2871  } else {
    28722872    quoted=owl_text_quote(recip, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
    28732873    owl_text_tr(quoted, ' ', '.');
    28742874    owl_text_tr(quoted, '\'', '.');
    28752875    owl_text_tr(quoted, '"', '.');
    2876     sprintf(buff + strlen(buff), " and recipient ^%s$", quoted);
     2876    owl_sprintf(" and recipient ^%s$", quoted);
    28772877    owl_free(quoted);
    28782878  }
    28792879
    2880   owl_function_punt(buff, direction);
    2881   owl_free(buff);
     2880  puntexpr = owl_sprintf("%s %s %s", classexpr, instexpr, recipexpr);
     2881  owl_function_punt(puntexpr, direction);
     2882  owl_free(puntexpr);
     2883  owl_free(classexpr);
     2884  owl_free(instexpr);
     2885  owl_free(recipexpr);
    28822886}
    28832887
Note: See TracChangeset for help on using the changeset viewer.