diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-10-12 20:53:24 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-10-12 20:53:24 +0800 |
commit | 45dfa7f9ddd69c25cb32f932db4b2f7640471529 (patch) | |
tree | a3ec84f8603322dda2564f58cfe700727807791b | |
parent | 4372f3f5d8cc32f837f842d28f6e1e88feaf5b9f (diff) | |
download | pttbbs-45dfa7f9ddd69c25cb32f932db4b2f7640471529.tar pttbbs-45dfa7f9ddd69c25cb32f932db4b2f7640471529.tar.gz pttbbs-45dfa7f9ddd69c25cb32f932db4b2f7640471529.tar.bz2 pttbbs-45dfa7f9ddd69c25cb32f932db4b2f7640471529.tar.lz pttbbs-45dfa7f9ddd69c25cb32f932db4b2f7640471529.tar.xz pttbbs-45dfa7f9ddd69c25cb32f932db4b2f7640471529.tar.zst pttbbs-45dfa7f9ddd69c25cb32f932db4b2f7640471529.zip |
refactoring
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2244 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/fav.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c index f1fce63e..074cd590 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -83,11 +83,11 @@ static void fav_increase(fav_t *fp, fav_type_t *ft) break; case FAVT_LINE: fp->nLines++; - fp->lineID++; + cast_line(ft)->lid = ++fp->lineID; break; case FAVT_FOLDER: fp->nFolders++; - fp->folderID++; + cast_folder(ft)->fid = ++fp->folderID; break; } fav_number++; @@ -247,10 +247,8 @@ static void rebuild_fav(fav_t *fp, int clean_invisible) continue; break; case FAVT_LINE: - cast_line(ft)->lid = fp->lineID + 1; break; case FAVT_FOLDER: - cast_folder(ft)->fid = fp->folderID + 1; rebuild_fav(get_fav_folder(&fp->favh[i]), clean_invisible); break; default: @@ -690,14 +688,9 @@ static fav_type_t *init_add(fav_t *fp, int type) fav_type_t *fav_add_line(void) { fav_t *fp = get_current_fav(); - fav_type_t *ft; if (get_line_num(fp) >= MAX_LINE) return NULL; - ft = init_add(fp, FAVT_LINE); - if (ft == NULL) - return NULL; - cast_line(ft)->lid = get_line_id(fp); - return ft; + return init_add(fp, FAVT_LINE); } fav_type_t *fav_add_folder(void) @@ -712,7 +705,6 @@ fav_type_t *fav_add_folder(void) if (ft == NULL) return NULL; cast_folder(ft)->this_folder = alloc_folder_item(); - cast_folder(ft)->fid = get_folder_id(fp); // after fav_increase return ft; } @@ -798,15 +790,6 @@ static int add_and_remove_tag(fav_t *fp, fav_type_t *ft) ft->fp = NULL; set_attr(tmp, FAVH_TAG, FALSE); - /* give the new id */ - switch (tmp->type) { - case FAVT_FOLDER: - cast_folder(tmp)->fid = fav_get_tmp_fav()->folderID + 1; - break; - case FAVT_LINE: - cast_line(tmp)->lid = fav_get_tmp_fav()->lineID + 1; - break; - } if (fav_add(fav_get_tmp_fav(), tmp) < 0) return -1; fav_remove(fp, ft); |