< prev index next >

src/share/vm/logging/logTagLevelExpression.cpp

Print this page
rev 8933 : 8046148.01


  36 void LogTagLevelExpression::clear() {
  37   _ntags = 0;
  38   _ncombinations = 0;
  39   for (size_t combination = 0; combination < MaxCombinations; combination++) {
  40     _level[combination] = LogLevel::Invalid;
  41     _allow_other_tags[combination] = false;
  42     for (size_t tag = 0; tag < LogTag::MaxTags; tag++) {
  43       _tags[combination][tag] = LogTag::__NO_TAG;
  44     }
  45   }
  46   os::free(_string);
  47   _string = NULL;
  48 }
  49 
  50 bool LogTagLevelExpression::parse(const char* str, outputStream* errstream) {
  51   bool success = true;
  52   clear();
  53   if (str == NULL || strcmp(str, "") == 0) {
  54     str = DefaultExpressionString;
  55   }
  56   char* copy = os::strdup_check_oom(str, mtInternal);
  57   // Split string on commas
  58   for (char *comma_pos = copy, *cur = copy; success && comma_pos != NULL; cur = comma_pos + 1) {
  59     if (_ncombinations == MaxCombinations) {
  60       if (errstream != NULL) {
  61         errstream->print_cr("Can not have more than " SIZE_FORMAT " tag combinations in a what-expression.",
  62                             MaxCombinations);
  63       }
  64       success = false;
  65       break;
  66     }
  67 
  68     comma_pos = strchr(cur, ',');
  69     if (comma_pos != NULL) {
  70       *comma_pos = '\0';
  71     }
  72 
  73     // Parse the level, if specified
  74     LogLevelType level = LogLevel::Unspecified;
  75     char* equals = strchr(cur, '=');
  76     if (equals != NULL) {




  36 void LogTagLevelExpression::clear() {
  37   _ntags = 0;
  38   _ncombinations = 0;
  39   for (size_t combination = 0; combination < MaxCombinations; combination++) {
  40     _level[combination] = LogLevel::Invalid;
  41     _allow_other_tags[combination] = false;
  42     for (size_t tag = 0; tag < LogTag::MaxTags; tag++) {
  43       _tags[combination][tag] = LogTag::__NO_TAG;
  44     }
  45   }
  46   os::free(_string);
  47   _string = NULL;
  48 }
  49 
  50 bool LogTagLevelExpression::parse(const char* str, outputStream* errstream) {
  51   bool success = true;
  52   clear();
  53   if (str == NULL || strcmp(str, "") == 0) {
  54     str = DefaultExpressionString;
  55   }
  56   char* copy = os::strdup_check_oom(str, mtLogging);
  57   // Split string on commas
  58   for (char *comma_pos = copy, *cur = copy; success && comma_pos != NULL; cur = comma_pos + 1) {
  59     if (_ncombinations == MaxCombinations) {
  60       if (errstream != NULL) {
  61         errstream->print_cr("Can not have more than " SIZE_FORMAT " tag combinations in a what-expression.",
  62                             MaxCombinations);
  63       }
  64       success = false;
  65       break;
  66     }
  67 
  68     comma_pos = strchr(cur, ',');
  69     if (comma_pos != NULL) {
  70       *comma_pos = '\0';
  71     }
  72 
  73     // Parse the level, if specified
  74     LogLevelType level = LogLevel::Unspecified;
  75     char* equals = strchr(cur, '=');
  76     if (equals != NULL) {


< prev index next >