eccLib 1.3.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
Functions
common.c File Reference

Contains implementations for common functions and structs used by the other modules. More...

#include "common.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for common.c:

Functions

int strtok_ri (const char *restrict str, char delim, Py_ssize_t *restrict strLen, occurrence_t *restrict lastoccurrence)
 Version of strtok_r that doesn't modify the original string.
 
void percent_encode_char (char *restrict out, char c)
 Writes a percent encoded character to a buffer.
 
uint32_t strncount (const char *restrict str, char c, size_t len)
 Counts the number of occurrences of c in str.
 
void * memchr2 (const void *buf, int c1, int c2, size_t len)
 Finds the first occurrence of either c1 or c2 in buf.
 
static int gtf_range_compare (const void *a, const void *b)
 Comparison function for sorting ranges by start, then end.
 
pair_titer_contigs (pair_t *ranges, size_t *size)
 

Detailed Description

Contains implementations for common functions and structs used by the other modules.

Function Documentation

◆ gtf_range_compare()

static int gtf_range_compare ( const void *  a,
const void *  b 
)
static

Comparison function for sorting ranges by start, then end.

Parameters
apointer to the first range (long[2])
bpointer to the second range (long[2])
Returns
negative if a < b, 0 if equal, positive if a > b
Here is the caller graph for this function:

◆ iter_contigs()

pair_t * iter_contigs ( pair_t ranges,
size_t *  size 
)

Merges overlapping ranges in a sorted array of pairs.

Parameters
rangesthe array of pairs to merge
sizepointer to the number of pairs in the array, will be updated to the number of merged pairs
Returns
a pointer to the merged array of pairs
Here is the call graph for this function:
Here is the caller graph for this function: