mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Code Cleanup
- Removed unused util.cpp round_up_to and burndown_size functions.
This commit is contained in:
parent
ab95ef5ba5
commit
4aa79dccfa
2 changed files with 0 additions and 48 deletions
46
src/util.cpp
46
src/util.cpp
|
@ -33,7 +33,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <limits>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -44,7 +43,6 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <math.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
@ -58,12 +56,6 @@
|
||||||
|
|
||||||
extern Context context;
|
extern Context context;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
static inline unsigned round_up_to (unsigned n, unsigned target)
|
|
||||||
{
|
|
||||||
return n + target - (n % target);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Uses std::getline, because std::cin eats leading whitespace, and that means
|
// Uses std::getline, because std::cin eats leading whitespace, and that means
|
||||||
// that if a newline is entered, std::cin eats it and never returns from the
|
// that if a newline is entered, std::cin eats it and never returns from the
|
||||||
|
@ -356,44 +348,6 @@ int execute (
|
||||||
// Collides with std::numeric_limits methods
|
// Collides with std::numeric_limits methods
|
||||||
#undef max
|
#undef max
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
unsigned burndown_size (unsigned ntasks)
|
|
||||||
{
|
|
||||||
// Nearest 2
|
|
||||||
if (ntasks < 20)
|
|
||||||
return round_up_to (ntasks, 2);
|
|
||||||
|
|
||||||
// Nearest 10
|
|
||||||
if (ntasks < 50)
|
|
||||||
return round_up_to (ntasks, 10);
|
|
||||||
|
|
||||||
// Nearest 20
|
|
||||||
if (ntasks < 100)
|
|
||||||
return round_up_to (ntasks, 20);
|
|
||||||
|
|
||||||
// Choose the number from here rounded up to the nearest 10% of the next
|
|
||||||
// highest power of 10 or half of power of 10.
|
|
||||||
const unsigned count = (unsigned) log10 (std::numeric_limits<unsigned>::max ());
|
|
||||||
unsigned half = 500;
|
|
||||||
unsigned full = 1000;
|
|
||||||
|
|
||||||
// We start at two because we handle 5, 10, 50, and 100 above.
|
|
||||||
for (unsigned i = 2; i < count; ++i)
|
|
||||||
{
|
|
||||||
if (ntasks < half)
|
|
||||||
return round_up_to (ntasks, half / 10);
|
|
||||||
|
|
||||||
if (ntasks < full)
|
|
||||||
return round_up_to (ntasks, full / 10);
|
|
||||||
|
|
||||||
half *= 10;
|
|
||||||
full *= 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Round up to max of unsigned.
|
|
||||||
return std::numeric_limits<unsigned>::max ();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Encode values prior to serialization.
|
// Encode values prior to serialization.
|
||||||
// [ -> &open;
|
// [ -> &open;
|
||||||
|
|
|
@ -63,8 +63,6 @@ int execute (const std::string&, const std::vector <std::string>&, const std::st
|
||||||
|
|
||||||
void combine (std::vector <int>&, const std::vector <int>&);
|
void combine (std::vector <int>&, const std::vector <int>&);
|
||||||
|
|
||||||
unsigned burndown_size (unsigned ntasks);
|
|
||||||
|
|
||||||
const std::string encode (const std::string&);
|
const std::string encode (const std::string&);
|
||||||
const std::string decode (const std::string&);
|
const std::string decode (const std::string&);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue