sapling/hgext/extlib/cfastmanifest/tree_iterator.h
Saurabh Singh 9da30944be cfastmanifest: move to hgext/extlib/
Summary:
Moves ctreemanifest into hgext/extlib/. D6679698 was committed to scratch branch
by mistake.

Test Plan: make local && cd tests && ./run-tests.py

Reviewers: durham, #mercurial, #sourcecontrol

Reviewed By: durham

Differential Revision: https://phabricator.intern.facebook.com/D6684623

Signature: 6684623:1515522634:9bec363d00990d9ff7d5f655e30ab8cae636155c
2018-01-09 10:36:54 -08:00

44 lines
1011 B
C

// Copyright 2016-present Facebook. All Rights Reserved.
//
// tree_iterator.c: declarations for traversing all the nodes of a tree
// in-order.
//
// no-check-code
#ifndef __FASTMANIFEST_TREE_ITERATOR_H__
#define __FASTMANIFEST_TREE_ITERATOR_H__
#include <stdbool.h>
#include <stdlib.h>
#include "node.h"
typedef struct _path_record_t {
const node_t* node;
size_t child_idx;
// this is how much of the path was already present when we started walking
// this node. once we close this path, we should restore the iterator's
// path_idx to this. value.
size_t previous_path_idx;
} path_record_t;
struct _iterator_t {
tree_t* copy;
bool construct_paths;
// track where we are in the iteration process.
path_record_t *path_records;
// this is where the next path record should be written to.
size_t path_records_idx;
// track the path, if path construction is requested.
char *path;
size_t path_idx;
size_t path_sz;
};
#endif // #ifndef __FASTMANIFEST_TREE_ITERATOR_H__