Skip to content

Commit

Permalink
Make YR_STOPWATCH to have the same size, independently of HAVE_CLOCK_…
Browse files Browse the repository at this point in the history
…GETTIME being true or not. (VirusTotal#1125)

* Make YR_STOPWATCH to have the same size in Linux, independently of HAVE_CLOCK_GETTIME being true or not.

No matter the value for HAVE_CLOCK_GETTIME the YR_STOPWATCH structure now have the same size, and users of the library don't  need to provide the right value for HAVE_CLOCK_GETTIME while building their programs.

* Change #elif to #else.

* Build with profiling enabled in Travis-CI.

* Try to fix issue with certificates in Travis CI.

* Fix typo.
  • Loading branch information
plusvic authored Sep 10, 2019
1 parent 8e27830 commit 8034b84
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: c

matrix:
include:

# Build for 64-bit Linux with profiling enabled
- os: linux
dist: trusty
sudo: required
Expand All @@ -13,6 +15,17 @@ matrix:
install: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool libjansson-dev libmagic-dev libssl-dev
# Build for 64-bit Linux with profiling enabled
- os: linux
dist: trusty
sudo: required
env: CONFIGFLAGS="CFLAGS=-m64 --enable-cuckoo --enable-magic --enable-address-sanitizer --enable-profiling"
install: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool libjansson-dev libmagic-dev libssl-dev
# Build for 32-bit Linux
- os: linux
dist: trusty
sudo: required
Expand All @@ -23,27 +36,35 @@ matrix:
sudo apt-get remove postgresql-9.3
sudo apt-get upgrade -y gcc
sudo apt-get install -y gcc-multilib autoconf automake libtool libjansson-dev:i386 libmagic-dev:i386 libssl-dev:i386
# Build for 64-bit Window using MinGW cross-compiler
- os: linux
dist: trusty
sudo: required
env: CONFIGFLAGS=--host=x86_64-w64-mingw32
install: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64 autoconf automake libtool
# Build for 64-bit Window using MinGW cross-compiler
- os: linux
dist: trusty
sudo: required
env: CONFIGFLAGS=--host=i686-w64-mingw32
install: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64 autoconf automake libtool
# Build for 64-bit Linux using Bazel instead of make.
- os: linux
dist: trusty
install: |
wget https://github.com/bazelbuild/bazel/releases/download/0.29.0/bazel_0.29.0-linux-x86_64.deb
sudo dpkg -i bazel_0.29.0-linux-x86_64.deb
before_script: bazel info
script: bazel test //tests/...

# Build for OS X
- os: osx
osx_image: xcode7.3
- os: osx
Expand Down Expand Up @@ -74,6 +95,9 @@ env:
- secure: "JWobvJ94pWt/xVciQURkNFS3I+gyu2IyZPKYEs6HDlHrpHs4BoVDZeRjmgx0s6aDeQjKJHowGDu17IlbnCkKzXrZErEJkA+Oc/d0SwgXKiUU9WYiaGBJjJUoYZw66QIEuGGKkF4uQ7EIcW/vN7wzrCDyAiPeOPUjVP4Tc2XRzmkSfakfmf9cE5nqT84DPUYiRegM7iepMrZi9kEaAoboBuETT+6eUKdERRadM0QNjZmCYMEMjtFj3lE51Ey2stGqZdKJvJN0FUmxGoaXCFFAsNmZPnFeDkqTf0a+MzxG2m4nnIXyNC/nT5XLItKHog4KROHb4tUpCZJ4iJhcw3loWMCtkZqB2fq2PaOkKk2zxPr3HLCn7ltmOzReBEDjEg68UqWydRW5534JGosbcA9IfshS1VqnZLgGwQHieXNeqhJUumt1DpON7AQEiEzbzAk0y2VcPlDPuCt9QS1k+zPMZLzbwgvs1ZOH39oFESW+iEDdzZjbhyC3J6azTHFcnA7r5SsYe1pzcSUaYtS1ehhb0lU/442JSHw2j00Nv9qFycYNvDrRNQNBxLziVustT0WJoVdFlkKy16iu1tUYOVXKgmMfqUDINfU6zRz3DskVuB9MZzq/4cMdK4jMRIDNZWvye1BzM7o/PiJoNaQc/6iav2RD+5YV46bBr60TqnYyjlM="

addons:
apt:
packages:
- ca-certificates
coverity_scan:
project:
name: "plusvic/yara"
Expand Down
13 changes: 4 additions & 9 deletions libyara/include/yara/stopwatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,16 @@ typedef struct _YR_STOPWATCH

} YR_STOPWATCH;

#elif defined(HAVE_CLOCK_GETTIME)

typedef struct _YR_STOPWATCH
{
struct timespec ts_start;

} YR_STOPWATCH;

#else

#include <sys/time.h>

typedef struct _YR_STOPWATCH
{
struct timeval tv_start;
union {
struct timeval tv_start;
struct timespec ts_start;
};

} YR_STOPWATCH;

Expand Down

0 comments on commit 8034b84

Please sign in to comment.