void check_result(lua_State * L, int result) { if (result) { if (is_exception(L, -1)) { to_exception(L, -1).rethrow(); } else { throw script_exception(lua_tostring(L, -1)); } } }
void workflow::transformation_activity(const processed_object& o) { auto p(profiler_.generate(o)); bool nothing_set(!p.is_enumeration() && !p.is_exception() && !p.is_value_object() && !p.is_service() && !p.is_concept()); if (p.is_uml_class() && nothing_set) p.is_value_object(true); validator_.validate(p); transformer_->transform(o, p); }
static void check_message(const struct set_name_fn *fn, const char *op, const char *nameincert, int match, const char *name) { char msg[1024]; if (match < 0) return; BIO_snprintf(msg, sizeof(msg), "%s: %s: [%s] %s [%s]", fn->name, op, nameincert, match ? "matches" : "does not match", name); if (is_exception(msg)) return; puts(msg); ++errors; }
void title_case(struct value* sentence, struct value* exceptions){ for (struct cons* cons = sentence->list; cons; cons = cons->next){ struct value* v = cons->value; char* word = v->string; for (int i = 0; word[i]; i++) word[i] = tolower(word[i]); if(!is_exception(word, exceptions)) word[0] = toupper(word[0]); printf("%s ", word); } printf("\n"); }
/* * Plain and simple, build an array of names for fstypes * Returns 0, if it encounters a problem. */ int build_fstype_list(char ***fstypep) { int i; int nfstype; char buf[FSTYPSZ + 1]; if ((nfstype = sysfs(GETNFSTYP)) < 0) { perror("sysfs(GETNFSTYP)"); return (0); } if ((*fstypep = calloc(nfstype, sizeof (char *))) == NULL) { perror("calloc() fstypes"); return (0); } for (i = 1; i < nfstype; i++) { if (sysfs(GETFSTYP, i, buf) < 0) { perror("sysfs(GETFSTYP)"); return (0); } if (buf[0] == 0) continue; /* If this is part of the exception list, move on */ if (is_exception(buf)) continue; if (((*fstypep)[i] = strdup(buf)) == NULL) { perror("strdup() fstype name"); return (0); } } return (i); }
/* * We have an array of entities that are potentially stat-able. Using * the name (e_name) of the entity, attempt to construct a ksname suitable * for use by kstat_lookup(3kstat) and fill it into the e_ksname member. * * We check the e_name against the list of file system types. If there is * no match then test to see if the path is valid. If the path is valid, * then determine the mountpoint. */ void set_ksnames(entity_t *entities, int nentities, char **fstypes, int nfstypes) { int i, j; struct statvfs64 statvfsbuf; for (i = 0; i < nentities; i++) { entity_t *ep = &entities[i]; /* Check the name against the list of fstypes */ for (j = 1; j < nfstypes; j++) { if (fstypes[j] && ep->e_name && strcmp(ep->e_name, fstypes[j]) == 0) { /* It's a file system type */ ep->e_type = ENTYPE_FSTYPE; (void) snprintf(ep->e_ksname, KSTAT_STRLEN, "%s%s", VOPSTATS_STR, ep->e_name); /* Now allocate the vopstats array */ ep->e_vs = calloc(VS_SIZE, sizeof (vopstats_t)); if (entities[i].e_vs == NULL) { perror("calloc() fstype vopstats"); exit(1); } break; } } if (j < nfstypes) /* Found it! */ continue; /* * If the entity in the exception list of fstypes, then * null out the entry so it isn't displayed and move along. */ if (is_exception(ep->e_name)) { ep->e_ksname[0] = 0; continue; } /* If we didn't find it, see if it's a path */ if (ep->e_name == NULL || statvfs64(ep->e_name, &statvfsbuf)) { /* Error - Make sure the entry is nulled out */ ep->e_ksname[0] = 0; continue; } (void) snprintf(ep->e_ksname, KSTAT_STRLEN, "%s%lx", VOPSTATS_STR, statvfsbuf.f_fsid); ep->e_fsid = statvfsbuf.f_fsid; if (set_mntpt(ep)) { (void) fprintf(stderr, gettext("Can't determine type of \"%s\"\n"), ep->e_name ? ep->e_name : gettext("<NULL>")); } else { ep->e_type = ENTYPE_MNTPT; } /* Now allocate the vopstats array */ ep->e_vs = calloc(VS_SIZE, sizeof (vopstats_t)); if (entities[i].e_vs == NULL) { perror("calloc() vopstats array"); exit(1); } } }
static int exception_pred(lua_State * L) { return push_boolean(L, is_exception(L, 1)); }