↩ revert:

This commit is contained in:
lzy
2024-05-27 02:33:10 +08:00
parent 2336f88407
commit a277dec1fe
136 changed files with 606 additions and 606 deletions

View File

@@ -20,7 +20,7 @@ struct node_st
};
struct node_st* tree = NULL;
struct node_st *tree = NULL;
/**
* @brief 插入节点
@@ -35,9 +35,9 @@ struct node_st* tree = NULL;
* @param data
* @return int
*/
static int insert(struct node_st** root, struct score_st* data)
static int insert(struct node_st **root, struct score_st *data)
{
struct node_st* node;
struct node_st *node;
if (NULL == *root)
{
@@ -59,7 +59,7 @@ static int insert(struct node_st** root, struct score_st* data)
}
struct score_st* find(struct node_st* root, int id)
struct score_st *find(struct node_st *root, int id)
{
if (NULL == root)
return NULL;
@@ -72,13 +72,13 @@ struct score_st* find(struct node_st* root, int id)
return find(root->r, id);
}
static void print_s(struct score_st* d)
static void print_s(struct score_st *d)
{
printf("%d %s %d %d\n", d->id, d->name, d->math, d->chinese);
}
static void draw_(struct node_st* root, int level)
static void draw_(struct node_st *root, int level)
{
if (NULL == root)
return;
@@ -100,7 +100,7 @@ static void draw_(struct node_st* root, int level)
*D
* @param root
*/
static void draw(struct node_st* root)
static void draw(struct node_st *root)
{
draw_(root, 0);
@@ -117,7 +117,7 @@ static void draw(struct node_st* root)
* @param root
* @return int
*/
static int get_num(struct node_st* root)
static int get_num(struct node_st *root)
{
if (NULL == root)
return 0;
@@ -126,7 +126,7 @@ static int get_num(struct node_st* root)
}
static struct node_st* find_min(struct node_st* root)
static struct node_st *find_min(struct node_st *root)
{
if (NULL == root->l)
return root;
@@ -141,9 +141,9 @@ static struct node_st* find_min(struct node_st* root)
*
* @param root
*/
static void turn_left(struct node_st** root)
static void turn_left(struct node_st **root)
{
struct node_st* cur = *root;
struct node_st *cur = *root;
*root = cur->r;
cur->r = NULL;
@@ -154,7 +154,7 @@ static void turn_left(struct node_st** root)
}
static struct node_st* find_max(struct node_st* root)
static struct node_st *find_max(struct node_st *root)
{
if (NULL == root->r)
return root;
@@ -169,9 +169,9 @@ static struct node_st* find_max(struct node_st* root)
*
* @param root
*/
static void turn_right(struct node_st** root)
static void turn_right(struct node_st **root)
{
struct node_st* cur = *root;
struct node_st *cur = *root;
*root = cur->l;
cur->l = NULL;
@@ -189,7 +189,7 @@ static void turn_right(struct node_st** root)
*
* @param root
*/
static void balance(struct node_st** root)
static void balance(struct node_st **root)
{
if (NULL == *root)
return;
@@ -221,10 +221,10 @@ static void balance(struct node_st** root)
* @param root
* @param tmpid
*/
static void delete(struct node_st** root, int id)
static void delete(struct node_st **root, int id)
{
struct node_st** node = root;
struct node_st* cur;
struct node_st **node = root;
struct node_st *cur;
while (*node != NULL && (*node)->data.id != id)
{
@@ -279,16 +279,16 @@ static void travel(struct node_st *root)
*
* @param root
*/
static void travel(struct node_st* root)
static void travel(struct node_st *root)
{
if (NULL == root)
return;
int ret;
QUEUE* qu;
struct node_st* cur;
QUEUE *qu;
struct node_st *cur;
qu = queue_create(sizeof(struct node_st*));
qu = queue_create(sizeof(struct node_st *));
if (NULL == qu)
return;

View File

@@ -9,14 +9,14 @@
struct node_st
{
struct node_st* ch[26];
struct node_st *ch[26];
char desc[DESC_SIZE];
};
static int get_word(FILE* fp, char* key, char* desc)
static int get_word(FILE *fp, char *key, char *desc)
{
char buf[BUFSIZE];
char* retp;
char *retp;
int i, j;
retp = fgets(buf, BUFSIZE, fp);
@@ -36,9 +36,9 @@ static int get_word(FILE* fp, char* key, char* desc)
return 0;
}
static struct node_st* newnode( )
static struct node_st *newnode( )
{
struct node_st* node;
struct node_st *node;
int i;
node = malloc(sizeof(*node));
@@ -53,7 +53,7 @@ static struct node_st* newnode( )
return node;
}
static int insert(struct node_st** root, char* key, char* desc)
static int insert(struct node_st **root, char *key, char *desc)
{
if (NULL == *root)
{
@@ -71,7 +71,7 @@ static int insert(struct node_st** root, char* key, char* desc)
return insert((*root)->ch + *key - 'a', key + 1, desc);
}
static char* find(struct node_st* root, char* key)
static char *find(struct node_st *root, char *key)
{
if (NULL == root)
return NULL;
@@ -84,11 +84,11 @@ static char* find(struct node_st* root, char* key)
int main( )
{
struct node_st* tree;
FILE* fp;
struct node_st *tree;
FILE *fp;
char desc[DESC_SIZE] = {'\0'}, key[KEY_SIZE] = {'\0'};
int ret;
char* datap;
char *datap;
fp = fopen(FNAME, "r");
if (NULL == fp)

View File

@@ -12,10 +12,10 @@ struct node_st
};
struct node_st* tree = NULL;
struct node_st *tree = NULL;
static void draw_(struct node_st* root, int level)
static void draw_(struct node_st *root, int level)
{
if (NULL == root)
return;
@@ -37,17 +37,17 @@ static void draw_(struct node_st* root, int level)
*D
* @param root
*/
static void draw(struct node_st* root)
static void draw(struct node_st *root)
{
draw_(root, 0);
printf("\n\n");
}
static struct node_st* load_(FILE* fp)
static struct node_st *load_(FILE *fp)
{
int c;
struct node_st* root;
struct node_st *root;
c = fgetc(fp);
/* if error */
@@ -78,10 +78,10 @@ static struct node_st* load_(FILE* fp)
static struct node_st* load(const char* path)
static struct node_st *load(const char *path)
{
FILE* fp;
struct node_st* root;
FILE *fp;
struct node_st *root;
fp = fopen(path, "r");
if (NULL == fp)
@@ -96,7 +96,7 @@ static struct node_st* load(const char* path)
int main( )
{
struct node_st* root;
struct node_st *root;
root = load(FNAME);

View File

@@ -12,7 +12,7 @@ struct node_st
};
struct node_st* tree = NULL;
struct node_st *tree = NULL;
/**
* @brief 插入节点
@@ -27,9 +27,9 @@ struct node_st* tree = NULL;
* @param data
* @return int
*/
static int insert(struct node_st** root, int data)
static int insert(struct node_st **root, int data)
{
struct node_st* node;
struct node_st *node;
if (NULL == *root)
{
@@ -51,7 +51,7 @@ static int insert(struct node_st** root, int data)
}
static void draw_(struct node_st* root, int level)
static void draw_(struct node_st *root, int level)
{
if (NULL == root)
return;
@@ -73,7 +73,7 @@ static void draw_(struct node_st* root, int level)
*D
* @param root
*/
static void draw(struct node_st* root)
static void draw(struct node_st *root)
{
draw_(root, 0);
@@ -81,7 +81,7 @@ static void draw(struct node_st* root)
}
static int save_(struct node_st* root, FILE* fp)
static int save_(struct node_st *root, FILE *fp)
{
fputc('(', fp);
/* if error */
@@ -102,9 +102,9 @@ static int save_(struct node_st* root, FILE* fp)
/* if error */
}
static int save(struct node_st* root, const char* path)
static int save(struct node_st *root, const char *path)
{
FILE* fp;
FILE *fp;
fp = fopen(path, "w");
if (NULL == fp)
return -1;
@@ -122,7 +122,7 @@ int main( )
{
char arr[] = "cefadjbh";
int i;
struct score_st* datap;
struct score_st *datap;
for (i = 0; i < sizeof(arr) / sizeof(*arr) - 1; i++)
{