summaryrefslogtreecommitdiffabout
path: root/cvs/sv_sync_www.c
Unidiff
Diffstat (limited to 'cvs/sv_sync_www.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cvs/sv_sync_www.c48
1 files changed, 3 insertions, 45 deletions
diff --git a/cvs/sv_sync_www.c b/cvs/sv_sync_www.c
index 7af1271..a251269 100644
--- a/cvs/sv_sync_www.c
+++ b/cvs/sv_sync_www.c
@@ -578,57 +578,15 @@ schedule_job (uid_t uid, gid_t gid, const char *file,
578 578
579/* Multi-job support */ 579/* Multi-job support */
580 580
581static int
582dir_cmp (const char *a, const char *b)
583{
584 if (!a)
585 {
586 if (b)
587 return -1;
588 else
589 return 0;
590 }
591 else if (!b)
592 return 1;
593 return strcmp (a, b);
594}
595
596static int
597ent_cmp (const void *a, const void *b)
598{
599 const struct sync_entry *sa = a;
600 const struct sync_entry *sb = b;
601 int rc;
602
603 rc = strcmp (sa->repo, sb->repo);
604 if (rc)
605 return rc;
606 rc = dir_cmp (sa->dir, sb->dir);
607 if (rc)
608 return rc;
609 return sa->files - sb->files;
610}
611
612int 581int
613do_sync (struct sync_entry *array, size_t count) 582do_sync (struct sync_entry *array, size_t count)
614{ 583{
615 int rc = 0; 584 int rc = 0;
616 struct sync_entry *sp, *lastp = NULL; 585 struct sync_entry *sp;
617 586
618 /* Sort the array */
619 qsort (array, count, sizeof array[0], ent_cmp);
620
621 for (sp = array; sp < array + count; sp++) 587 for (sp = array; sp < array + count; sp++)
622 { 588 rc |= sync_www (sp->repo, sp->dir, sp->files);
623 if (lastp) 589
624 {
625 if (strcmp (lastp->repo, sp->repo) == 0
626 && dir_cmp (lastp->dir, sp->dir) == 0)
627 continue;
628 }
629 rc |= sync_www (sp->repo, sp->dir, sp->files);
630 lastp = sp;
631 }
632 if (debug) 590 if (debug)
633 fprintf (stderr, "do_sync: returning %d\n",rc); 591 fprintf (stderr, "do_sync: returning %d\n",rc);
634 return rc; 592 return rc;

Return to:

Send suggestions and report system problems to the System administrator.