static void update_one(const char *path, const char *prefix, int prefix_length) { const char *p = prefix_path(prefix, prefix_length, path); if (!verify_path(p)) { fprintf(stderr, "Ignoring path %s\n", path); goto free_return; } if (mark_valid_only) { if (mark_valid(p)) die("Unable to mark file %s", path); goto free_return; } if (force_remove) { if (remove_file_from_cache(p)) die("git update-index: unable to remove %s", path); report("remove '%s'", path); goto free_return; } if (process_path(p)) die("Unable to process path %s", path); report("add '%s'", path); free_return: if (p < path || p > path + strlen(path)) free((char*)p); }
int get_next_person(int fd, person_t **new_person) { char *temp; int eof_flag; *new_person = (person_t*)malloc(sizeof(person_t)); //read and validate NAME get_next_value(fd, &((**new_person).name)); if (!name_valid((**new_person).name)) return (INVALID_NAME); printf("mkay"); return (0); //read and validate SURENAME get_next_value(fd, &((**new_person).surename)); if (!surename_valid((**new_person).surename)) return (INVALID_SURENAME); //read and validate EMAIL get_next_value(fd, &((**new_person).email)); if (!email_valid((**new_person).email)) return (INVALID_EMAIL); //read and validate MARK get_next_value(fd, &temp); if (!mark_valid(temp)) return (INVALID_MARK); (**new_person).mark = atof(temp); //read and validate COUNTY eof_flag = get_next_value(fd, &((**new_person).county)); if (!county_valid((**new_person).name)) return (INVALID_COUNTY); if (eof_flag == END_OF_FILE) return (END_OF_FILE); return (1); }
void Header::extract(const char *data, const PHV &phv) { if (is_VL_header()) return extract_VL(data, phv); int hdr_offset = 0; for (Field &f : fields) { hdr_offset += f.extract(data, hdr_offset); data += hdr_offset / 8; hdr_offset = hdr_offset % 8; } mark_valid(); }
static int mark_idx(int c) { if(!mark_valid(c)) return 0; switch(c){ case '\'': return 36; case '.': return 37; } if('a' <= c && c <= 'z') return c - 'a' + 10; return c - '0'; }
void mouseClicked(struct game *g) { int clickedx, clickedy; if (!get_mousecoords(g, &clickedx, &clickedy)) return; if (g->marked) { unselect_background(g); select_tmino(g, clickedx, clickedy); } else if (mark_valid(g)) { unselect_tmino(g); move_mark_to_selection(g); } else { unselect_tmino(g); unselect_background(g); } redraw_field(g); }
void Header::extract_VL(const char *data, const PHV &phv) { static thread_local Data computed_nbits; int VL_offset = header_type.get_VL_offset(); int hdr_offset = 0; // Should I take care of nbytes_phv? I don't think it is being used anymore nbytes_packet = 0; for (int i = 0; i < header_type.get_num_fields(); i++) { Field &f = fields[i]; if (VL_offset == i) { VL_expr->eval(phv, &computed_nbits); hdr_offset += f.extract_VL(data, hdr_offset, computed_nbits.get_int()); } else { hdr_offset += f.extract(data, hdr_offset); } data += hdr_offset / 8; hdr_offset = hdr_offset % 8; nbytes_packet += f.get_nbits(); } assert(nbytes_packet % 8 == 0); nbytes_packet /= 8; mark_valid(); }