remove extralib
This commit is contained in:
parent
48587368ca
commit
0b1e310749
7 changed files with 144 additions and 91 deletions
|
|
@ -12,7 +12,7 @@
|
|||
#include "xce/types.h"
|
||||
#include "xlist.h"
|
||||
#include "zarray.h"
|
||||
#include <basiclib/list.h>
|
||||
#include "xcelist.h"
|
||||
|
||||
// in seconds
|
||||
#define DEFAULT_CHECK_INTERVAL 30
|
||||
|
|
|
|||
98
src/flake.lock
generated
98
src/flake.lock
generated
|
|
@ -1,25 +1,5 @@
|
|||
{
|
||||
"nodes": {
|
||||
"extralib": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764921004,
|
||||
"narHash": "sha256-Odh7nfv8ynvrM0b7BxsDgnM76dTJfjakn+U5Re6LCBc=",
|
||||
"ref": "main",
|
||||
"rev": "d370b0450779b6c8befc88fd41cc06c9e1e4e40a",
|
||||
"revCount": 3,
|
||||
"type": "git",
|
||||
"url": "ssh://forgejo@gitea.shenrs.eu/nexa/extralibs"
|
||||
},
|
||||
"original": {
|
||||
"ref": "main",
|
||||
"type": "git",
|
||||
"url": "ssh://forgejo@gitea.shenrs.eu/nexa/extralibs"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -126,28 +106,10 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_6": {
|
||||
"inputs": {
|
||||
"systems": "systems_6"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"librtti": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"xbuild": "xbuild"
|
||||
},
|
||||
"locked": {
|
||||
|
|
@ -168,8 +130,8 @@
|
|||
"nix-appimage": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils_5",
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
"flake-utils": "flake-utils_4",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1757920913,
|
||||
|
|
@ -186,22 +148,6 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764517877,
|
||||
"narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1764950072,
|
||||
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
|
||||
|
|
@ -217,7 +163,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1764667669,
|
||||
"narHash": "sha256-7WUCZfmqLAssbDqwg9cUDAXrSoXN79eEEq17qhTNM/Y=",
|
||||
|
|
@ -233,7 +179,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1745997950,
|
||||
"narHash": "sha256-FklMkU+bPPx0L3i6pdrw65js05VO9He3DTeKguX9GQY=",
|
||||
|
|
@ -249,7 +195,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1769461804,
|
||||
"narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=",
|
||||
|
|
@ -265,7 +211,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_6": {
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1777954456,
|
||||
"narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
|
||||
|
|
@ -392,11 +338,10 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"extralib": "extralib",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flake-utils": "flake-utils",
|
||||
"librtti": "librtti",
|
||||
"nix-appimage": "nix-appimage",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"xbuild": "xbuild_2"
|
||||
}
|
||||
},
|
||||
|
|
@ -475,21 +420,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_6": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"uv2nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
@ -541,8 +471,8 @@
|
|||
},
|
||||
"xbuild": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_4",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769064169,
|
||||
|
|
@ -561,8 +491,8 @@
|
|||
},
|
||||
"xbuild_2": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_6",
|
||||
"nixpkgs": "nixpkgs_6",
|
||||
"flake-utils": "flake-utils_5",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"npm-lockfile-fix": "npm-lockfile-fix",
|
||||
"pyproject-build-systems": "pyproject-build-systems",
|
||||
"pyproject-nix": "pyproject-nix_2",
|
||||
|
|
|
|||
|
|
@ -4,13 +4,12 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
xbuild.url = "github:shen390s/my-nix-channel?ref=master";
|
||||
extralib.url = "git+ssh://forgejo@gitea.shenrs.eu/nexa/extralibs?ref=main";
|
||||
librtti.url = "git+ssh://forgejo@gitea.shenrs.eu/rshen/librtti?ref=master";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nix-appimage.url = "github:ralismark/nix-appimage";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, xbuild, extralib, librtti, flake-utils, nix-appimage }:
|
||||
outputs = { self, nixpkgs, xbuild, librtti, flake-utils, nix-appimage }:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
myCommitId =
|
||||
|
|
@ -60,7 +59,7 @@
|
|||
in
|
||||
flake-utils.lib.eachSystem supportedSystems (
|
||||
system: let
|
||||
mypkgs = xbuild.packages.${system} // extralib.packages.${system} // librtti.packages.${system};
|
||||
mypkgs = xbuild.packages.${system} // librtti.packages.${system};
|
||||
overlays = [
|
||||
(final: prev: mypkgs // prev)
|
||||
];
|
||||
|
|
|
|||
44
src/include/xcelist.h
Normal file
44
src/include/xcelist.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#if !defined(__XCELIST_H__)
|
||||
#define __XCELIST_H__ 1
|
||||
|
||||
/*
|
||||
* Intrusive doubly-linked list.
|
||||
*
|
||||
* A list entry must have its `forw` and `back` pointers as its first two
|
||||
* members so that a user-defined node (e.g. `struct { void* forw; void* back;
|
||||
* ...payload... }`) can be safely cast to `xcelist_entry_t*`.
|
||||
*
|
||||
* The list head (`xcelist_t`) is itself layout-compatible with an entry: its
|
||||
* `forw` field points to the first entry (or back to itself when empty) and
|
||||
* its `back` field points to the last entry. `numEnts` tracks the entry count.
|
||||
*
|
||||
* This replaces the previously external `basiclib/list.h` (extralib) with the
|
||||
* minimal subset of functionality actually used in-tree.
|
||||
*/
|
||||
|
||||
typedef struct _xcelist_entry {
|
||||
struct _xcelist_entry* forw;
|
||||
struct _xcelist_entry* back;
|
||||
} xcelist_entry_t;
|
||||
|
||||
typedef struct _xcelist {
|
||||
/* head sentinel: must mirror xcelist_entry_t layout (forw/back first) */
|
||||
xcelist_entry_t* forw;
|
||||
xcelist_entry_t* back;
|
||||
int numEnts;
|
||||
char* name;
|
||||
} xcelist_t;
|
||||
|
||||
/* Create an empty list. `name` is copied and may be NULL. Returns NULL on OOM. */
|
||||
extern xcelist_t* list_create(const char* name);
|
||||
|
||||
/* Destroy a list. Does not free the entries; caller owns them. */
|
||||
extern void list_destroy(xcelist_t* list);
|
||||
|
||||
/* Append `entry` to the back (tail) of `list`. */
|
||||
extern void list_insert_entry_back(xcelist_t* list, xcelist_entry_t* entry);
|
||||
|
||||
/* Unlink `entry` from `list`. Does not free `entry`. */
|
||||
extern void list_entry_remove(xcelist_t* list, xcelist_entry_t* entry);
|
||||
|
||||
#endif
|
||||
|
|
@ -82,6 +82,7 @@ libxce_src = [ gen_srcs[0],
|
|||
'window.c',
|
||||
'xceapi.c',
|
||||
'xcectx.c',
|
||||
'xcelist.c',
|
||||
'xlist.c',
|
||||
'xstring.c',
|
||||
'zarray.c',
|
||||
|
|
|
|||
82
src/lib/xcelist.c
Normal file
82
src/lib/xcelist.c
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xcelist.h"
|
||||
|
||||
/*
|
||||
* Intrusive circular doubly-linked list.
|
||||
*
|
||||
* The list head (`xcelist_t`) doubles as a sentinel: when the list is empty,
|
||||
* both `forw` and `back` point back at the head. This keeps insertion and
|
||||
* removal branch-free while allowing `list->forw` to be read directly as the
|
||||
* first entry (as done by the autoscaler demand queue).
|
||||
*/
|
||||
|
||||
xcelist_t* list_create(const char* name)
|
||||
{
|
||||
xcelist_t* list = (xcelist_t*)calloc(1, sizeof(xcelist_t));
|
||||
if (!list) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* empty list: head points at itself */
|
||||
list->forw = (xcelist_entry_t*)list;
|
||||
list->back = (xcelist_entry_t*)list;
|
||||
list->numEnts = 0;
|
||||
|
||||
if (name) {
|
||||
list->name = strdup(name);
|
||||
if (!list->name) {
|
||||
free(list);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void list_destroy(xcelist_t* list)
|
||||
{
|
||||
if (!list) {
|
||||
return;
|
||||
}
|
||||
free(list->name);
|
||||
free(list);
|
||||
}
|
||||
|
||||
void list_insert_entry_back(xcelist_t* list, xcelist_entry_t* entry)
|
||||
{
|
||||
xcelist_entry_t* head;
|
||||
xcelist_entry_t* last;
|
||||
|
||||
if (!list || !entry) {
|
||||
return;
|
||||
}
|
||||
|
||||
head = (xcelist_entry_t*)list;
|
||||
last = head->back;
|
||||
|
||||
entry->forw = head;
|
||||
entry->back = last;
|
||||
last->forw = entry;
|
||||
head->back = entry;
|
||||
|
||||
list->numEnts++;
|
||||
}
|
||||
|
||||
void list_entry_remove(xcelist_t* list, xcelist_entry_t* entry)
|
||||
{
|
||||
if (!list || !entry || entry == (xcelist_entry_t*)list) {
|
||||
return;
|
||||
}
|
||||
|
||||
entry->back->forw = entry->forw;
|
||||
entry->forw->back = entry->back;
|
||||
|
||||
entry->forw = NULL;
|
||||
entry->back = NULL;
|
||||
|
||||
if (list->numEnts > 0) {
|
||||
list->numEnts--;
|
||||
}
|
||||
}
|
||||
|
|
@ -77,9 +77,6 @@ stdenv.mkDerivation {
|
|||
libcyaml
|
||||
libyaml
|
||||
libcgroup
|
||||
(extralib.overrideAttrs (oldAttrs: {
|
||||
separateDebugInfo = true;
|
||||
}))
|
||||
packcc
|
||||
# Python — for xceadmin (admin config tool, src/xceadmin/). pycapnp links
|
||||
# against the capnproto C++ runtime above; nix's python3Packages.pycapnp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue