diff options
| author | 2022-12-02 21:19:46 +0100 | |
|---|---|---|
| committer | 2022-12-02 21:19:46 +0100 | |
| commit | 0c525335ee222ef0d9145cb6aafa8e1da34ff756 (patch) | |
| tree | 12beb70208f07f7047c755cb7cbfffaac9425c4c | |
| parent | New function object_parent(). (diff) | |
| download | snac2-0c525335ee222ef0d9145cb6aafa8e1da34ff756.tar.gz snac2-0c525335ee222ef0d9145cb6aafa8e1da34ff756.tar.xz snac2-0c525335ee222ef0d9145cb6aafa8e1da34ff756.zip | |
New function object_here_by_md5().
| -rw-r--r-- | data.c | 13 |
1 files changed, 9 insertions, 4 deletions
| @@ -411,11 +411,18 @@ d_char *_object_fn(const char *id) | |||
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | 413 | ||
| 414 | int object_here_by_md5(char *id) | ||
| 415 | /* checks if an object is already downloaded */ | ||
| 416 | { | ||
| 417 | xs *fn = _object_fn_by_md5(id); | ||
| 418 | return mtime(fn) > 0.0; | ||
| 419 | } | ||
| 420 | |||
| 421 | |||
| 414 | int object_here(char *id) | 422 | int object_here(char *id) |
| 415 | /* checks if an object is already downloaded */ | 423 | /* checks if an object is already downloaded */ |
| 416 | { | 424 | { |
| 417 | xs *fn = _object_fn(id); | 425 | xs *fn = _object_fn(id); |
| 418 | |||
| 419 | return mtime(fn) > 0.0; | 426 | return mtime(fn) > 0.0; |
| 420 | } | 427 | } |
| 421 | 428 | ||
| @@ -818,10 +825,8 @@ d_char *timeline_top_level(d_char *list) | |||
| 818 | if (!object_parent(line, line2, sizeof(line2))) | 825 | if (!object_parent(line, line2, sizeof(line2))) |
| 819 | break; | 826 | break; |
| 820 | 827 | ||
| 821 | xs *pfn = _object_fn_by_md5(line2); | ||
| 822 | |||
| 823 | /* well, there is a parent... but if it's not there, use this */ | 828 | /* well, there is a parent... but if it's not there, use this */ |
| 824 | if (mtime(pfn) == 0.0) | 829 | if (!object_here_by_md5(line2)) |
| 825 | break; | 830 | break; |
| 826 | 831 | ||
| 827 | /* it's here! try again with its own parent */ | 832 | /* it's here! try again with its own parent */ |